I just wrote quite a long program and realized that "loop wrapping" monitors is not really an option.
It would be cool if I could just write mon.write("hi!") to all the monitors.
Any ideas?
Posted 07 July 2013 - 04:39 PM
Posted 07 July 2013 - 05:07 PM
Posted 07 July 2013 - 05:44 PM
mons =
{
add = function (self, mon) self[#self + 1] = mon end,
__index = function (tbl, key) return function(...) for i = 1, #tbl do tbl[i][key](...) end end end
}
setmetatable(mons,mons)
Posted 07 July 2013 - 06:49 PM
Posted 07 July 2013 - 08:42 PM
Posted 08 July 2013 - 12:43 AM
AgentE382, on 07 July 2013 - 05:44 PM, said:
Posted 08 July 2013 - 06:07 AM
theoriginalbit, on 08 July 2013 - 12:43 AM, said:
AgentE382, on 07 July 2013 - 05:44 PM, said:
Posted 08 July 2013 - 06:28 AM
AgentE382, on 08 July 2013 - 06:07 AM, said:
theoriginalbit, on 08 July 2013 - 12:43 AM, said:
AgentE382, on 07 July 2013 - 05:44 PM, said:
Posted 08 July 2013 - 11:34 AM
darkrising, on 08 July 2013 - 06:28 AM, said:
AgentE382, on 08 July 2013 - 06:07 AM, said:
theoriginalbit, on 08 July 2013 - 12:43 AM, said:
AgentE382, on 07 July 2013 - 05:44 PM, said:
mons =
{
add = function (self, mon) self[#self + 1] = mon end,
__index = function (tbl, key) return function(...) local funcs = {} for i = 1, #tbl do funcs[#funcs + 1] = function() tbl[i][key](...) end end paralel.waitForAll(unpack(funcs)) end end
}
setmetatable(mons,mons)
Posted 08 July 2013 - 12:43 PM
AgentE382, on 08 July 2013 - 11:34 AM, said:
darkrising, on 08 July 2013 - 06:28 AM, said:
AgentE382, on 08 July 2013 - 06:07 AM, said:
theoriginalbit, on 08 July 2013 - 12:43 AM, said:
AgentE382, on 07 July 2013 - 05:44 PM, said:
mons =
{
add = function (self, mon) self[#self + 1] = mon end,
__index = function (tbl, key) return function(...) local funcs = {} for i = 1, #tbl do funcs[#funcs + 1] = function() tbl[i][key](...) end end paralel.waitForAll(unpack(funcs)) end end
}
setmetatable(mons,mons)
0 members, 1 guests, 0 anonymous users