Posted 21 June 2015 - 10:46 PM
I was making a script for terminal glasses and thought i would just release this.
what it basicly does is you can use the fake table to do stuff like
and it will automatically go to the client without calling the sync function.
(if you dont like this format just tell me, i wrote this up real quick and will edit it later if you request so.)
Pastebin: http://pastebin.com/y2YbvJxf
what it basicly does is you can use the fake table to do stuff like
syncGlass.addText(2,2,"Auto-synced!",0xffffff)
and it will automatically go to the client without calling the sync function.
(if you dont like this format just tell me, i wrote this up real quick and will edit it later if you request so.)
Pastebin: http://pastebin.com/y2YbvJxf
function getGlass(g)
local function wrapObject(thing)
return setmetatable({},{
__index = function(s,i)
if(type(thing[i]) == 'function')then
return function(...)
local stuf = thing[i](...)
g.sync()
return stuf
end;
else
return thing[i]
end
end;
})
end
local fakeg = setmetatable({},{
__index = function(s,i)
if(type(g[i]) == 'function')then
return function(...)--//#wrapped
return (function() local a = wrapObject(g[i](...)) g.sync() return(a) end)()
end
else
return g[i]
end
end;
})
return fakeg
end
--//
local glass = peripheral.wrap("left")
local syncGlass = getGlass(glass)