Files
integration/luprex/core/lua/uglyglobals.lua

50 lines
1.1 KiB
Lua
Raw Normal View History

2022-03-31 14:41:19 -04:00
makeclass('ug')
function ug.the()
return tangible.scan('globals',0,0,0,true)[1]
end
lis=tangible.scan('globals',0,0,0,true)
if #lis==0 then
local ugid=tangible.build{class='ug',x=0,y=0,z=0,plane='globals',graphic='box'}
print("The global table is "..tangible.id(ugid))
end
function ug.set(var,val)
ug.the()[var]=val
end
function ug.get(var)
return ug.the()[var]
end
2022-04-25 12:20:29 -04:00
function login.cb_uglytimedaemon()
if not ug.get('time') then ug.set('time',0) end
while true do
wait(1)
ug.set('time',ug.get('time')+1)
end
end
function time() return ug.get('time') end
2022-05-18 13:20:48 -04:00
function isa(k1,k2)
if k1==k2 then return true end
if k1==nil then return false end
local mt=getmetatable(k1)
if not mt then return false end
return isa(mt.__index,k2)
end
function tabcat(t1,t2)
for i=1,#t2 do t1[#t1+1]=t2[i] end
end
function multistart(filter,closure)
local lis=tangible.scan('nowhere',0,0,1000000000,false)
lis=tabcat(lis,tangible.scan('main',0,0,1000000000,true)
for _,t in iparis(lis) do if filter(t) then closure(t) end end
end