Skip to content

Instantly share code, notes, and snippets.

@FurryHead
Created May 30, 2011 18:03
Show Gist options
  • Save FurryHead/999233 to your computer and use it in GitHub Desktop.
Save FurryHead/999233 to your computer and use it in GitHub Desktop.
dofile("irc.lua")
function main()
local servers = {}
for _,v in ipairs(IRC_SERVERS) do
servers[#servers+1] = lanes.gen("*", {globals = _G}, StartWithConfig)(v)
end
local done = false
local found = false
while not done do
for _,v in ipairs(servers) do
print(v[1])
if v.status ~= "done" then
found = true
end
end
if not found then
done = true
end
end
end
--Meanwhile, in irc.lua (trimmed down)
IRC = {}
function StartWithConfig(config_array)
local irc = IRC:new(config_array)
end
function IRC:new(config_array)
local mt = { }
mt.config = config_array
mt.actions = {
join = { },
part = { },
quit = { },
nick = { },
mode = { },
ping = { },
action = { },
message = { },
connect = { },
disconnect = { },
triggers = { },
}
return setmetatable(mt, {})
end
ERROR:
tc@box:~/ProBot$ lua bot.lua
--This refers to the last line in IRC:new()
lua: bot.lua:34: irc.lua:40: attempt to call global 'setmetatable' (a nil value)
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/lanes.lua:190: in function </usr/local/share/lua/5.1/lanes.lua:136>
bot.lua:23: in function 'main' -- This seems to be unrelated
bot.lua:34: in main chunk
[C]: ?
threading.c 399: pthread_cond_destroy(ref) failed, 16 EBUSY
Aborted
tc@box:~/ProBot$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment