require("multi.compat.love2d") multi.intergration={} multi.intergration.love2d={} multi.intergration.love2d.ThreadBase=[[ require("love.filesystem") require("love.system") require("love.timer") require("multi.all") GLOBAL={} setmetatable(GLOBAL,{ __index=function(t,k) return __proxy__[k] end, __newindex=function(t,k,v) __proxy__[k]=v if type(v)=="userdata" then __MainChan__:push(v) else __MainChan__:push("SYNC "..type(v).." "..k.." "..resolveData(v)) end end, }) function ToStr(val, name, skipnewlines, depth) skipnewlines = skipnewlines or false depth = depth or 0 local tmp = string.rep(" ", depth) if name then if type(name) == "string" then tmp = tmp .. "[\""..name.."\"] = " else tmp = tmp .. "["..(name or "").."] = " end end if type(val) == "table" then tmp = tmp .. "{" .. (not skipnewlines and " " or "") for k, v in pairs(val) do tmp = tmp .. ToStr(v, k, skipnewlines, depth + 1) .. "," .. (not skipnewlines and " " or "") end tmp = tmp .. string.rep(" ", depth) .. "}" elseif type(val) == "number" then tmp = tmp .. tostring(val) elseif type(val) == "string" then tmp = tmp .. string.format("%q", val) elseif type(val) == "boolean" then tmp = tmp .. (val and "true" or "false") else tmp = tmp .. "\"[inserializeable datatype:" .. type(val) .. "]\"" end return tmp end function resolveType(tp,d) if tp=="number" then return tonumber(d) elseif tp=="bool" then return (d=="true") elseif tp=="function" then return loadDump(d) elseif tp=="table" then return loadstring("return "..d)() else return d end end function resolveData(v) local data="" if type(v)=="table" then data=ToStr(v) elseif type(v)=="function" then data=dump(v) elseif type(v)=="string" or type(v)=="number" or type(v)=="bool" then data=tostring(v) end return data end sThread={} local function randomString(n) local c=os.clock() local a=0 while os.clock()