revised callback system to use multiple arguments; added tobitstring function in utility

This commit is contained in:
Redo
2019-05-10 21:07:35 -05:00
parent 10611449bf
commit d2a648f7d9
3 changed files with 17 additions and 5 deletions

View File

@@ -328,13 +328,11 @@ function Simulation:sendcallbacks()
local data = "CB"
for objref, args in pairs(self.callbacks) do
local argc = 0
local escargs = {}
for argidx, argv in ipairs(args) do
table.insert(escargs, expandescape(tostring(argv)))
argc = argc+1
end
data = data .. "\t" .. objref .. "\t"..argc..(#escargs>0 and ("\t"..table.concat(escargs, "\t")) or "")
data = data .. "\t" .. objref .. "\t"..(#escargs)..(#escargs>0 and ("\t"..table.concat(escargs, "\t")) or "")
end
client:send(data .. "\n")