-
Notifications
You must be signed in to change notification settings - Fork 0
Modules
soccermitchy edited this page Dec 11, 2012
·
4 revisions
A module is essentially overwriting the bot's functions in order to make the bot into something more like it. Modules are just ran like this (extracted from runme.lua lines 58 to 69):
` for i=1,#config.modules do
if exists("modules/"..config.modules[i].."/init.lua") then
s,r=pcall(function() dofile("modules/"..config.modules[i].."/init.lua") end)
if s==false then
print("ERROR: Module "..config.modules[i].." not loaded. Reason: failed execution. Lua error: "..r)
else
print("MODLOAD: Module "..config.modules[i].." has been successfully loaded.")
end
else
print("WARNING: Module "..config.modules[i].." not loaded. Reason: not found.")
end
end ` In other words, they are just ran in a pcall. If a module has an error, it is printed to the console, not /dev/null :P The bot's source code will become your best friend if/when you write modules.