improved number field precision handling and limited decimal precision of timeouts #396

This commit is contained in:
Mikayla Fischler
2023-12-30 14:41:03 -05:00
parent 2a85a438ba
commit 42cd9fff0c
6 changed files with 74 additions and 27 deletions

View File

@ -22,7 +22,7 @@ local t_pack = table.pack
local util = {}
-- scada-common version
util.version = "1.1.11"
util.version = "1.1.12"
util.TICK_TIME_S = 0.05
util.TICK_TIME_MS = 50
@ -78,6 +78,17 @@ function util.strval(val)
else return tostring(val) end
end
-- tokenize a string by a separator<br>
-- does not behave exactly like C's strtok
---@param str string string to tokenize
---@param sep string separator to tokenize by
---@return table token_list
function util.strtok(str, sep)
local list = {}
for part in string.gmatch(str, "([^" .. sep .. "]+)") do t_insert(list, part) end
return list
end
-- repeat a space n times
---@nodiscard
---@param n integer