mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
improved number field precision handling and limited decimal precision of timeouts #396
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user