added escape sequences for brick uinames and descriptions

This commit is contained in:
Redo 2020-05-17 08:22:38 -05:00
parent cc0a770c81
commit 59dd5171b6
2 changed files with 26 additions and 10 deletions

View File

@ -8,6 +8,14 @@ GateDefinition = {
}
function GateDefinition:new(objref, name, description, init, logic, input, global, ports)
name = collapseescape(name)
init = collapseescape(init)
logic = collapseescape(logic)
input = collapseescape(input)
global = collapseescape(global)
description = collapseescape(description)
local o = {
objref = objref,
name = name,
@ -15,11 +23,6 @@ function GateDefinition:new(objref, name, description, init, logic, input, globa
ports = ports or {}
}
init = collapseescape(init)
logic = collapseescape(logic)
input = collapseescape(input)
global = collapseescape(global)
local initfunc = loadstring(tostring(init))
if initfunc~=nil then
o.init = initfunc() or function()end

View File

@ -15,7 +15,8 @@ OPT_TICK_ENABLED = true
OPT_TICK_TIME = 0.001
OPT_FX_UPDATES = true
OPT_FX_TIME = 0.03
OPT_TICK_INF = 13
OPT_TICK_INF = 29
OPT_TICK_MULT = 1
local tickdelay = 0
local ticksperinterval = 0
@ -156,7 +157,9 @@ while 1 do
sim:removegate(tonumber(data[i+1]))
i = i + 1
elseif data[i] == "GD" then
--print(table.concat(data, "\n", i, math.min(#data, i+100)))
--print("---------------------------------------[[[[")
--print(table.concat(data, "]]]]\n[[[[", i, math.min(#data, i+100)))
--print("]]]]---------------------------------------")
local objref = tonumber(data[i+1])
local name = data[i+2]
local desc = data[i+3]
@ -215,6 +218,7 @@ while 1 do
if value < 0 or value > 999999 then
value = 0
end
if value<=0.001 then value = 0.0001 end
OPT_TICK_TIME = value
elseif option == "FX_UPDATES" then
OPT_FX_UPDATES = toboolean(value)
@ -223,6 +227,8 @@ while 1 do
value = 0
end
OPT_FX_TIME = value
elseif option=="TICK_MULT" then
OPT_TICK_MULT = value
end
i = i + 2
@ -302,11 +308,18 @@ while 1 do
end
ticks = ticks+OPT_TICK_INF
else
sim:tick()
ticks = ticks+1
for i = 1, OPT_TICK_MULT do
sim:tick()
ticks = ticks+1
local elapsed = os.clock()-time
if elapsed>0.1 then
break
end
end
end
local sleeptime = time+OPT_TICK_TIME-os.clock()-0.03
local sleeptime = time+OPT_TICK_TIME-os.clock()-0.005
if sleeptime>0 then socket.sleep(sleeptime) end
end
else