Because assertion errors are big and scary (and don't direct the uneducated user to a solution), I'm considering doing the following in my distribution of wait.lua:
What do you think?
function make (f)
assert (type (f) == "function", "wait.make requires a function")
- assert (GetOption ("enable_timers") == 1, "Timers not enabled")
- assert (GetOption ("enable_triggers") == 1, "Triggers not enabled")
+ local errors = {}
+ if GetOption("enable_timers") ~= 1 then
+ table.insert(errors, "TIMERS")
+ end
+ if GetOption("enable_triggers") ~= 1 then
+ table.insert(errors, "TRIGGERS")
+ end
+ if #errors ~= 0 then
+ ColourNote("white","red","One of your scripts (in '"..(GetPluginInfo(GetPluginID(), 1) or "World").."') just did something that requires "..table.concat(errors, " and ").." to be enabled, but they aren't. Please check your configuration settings.")
+ return -1
+ end
coroutine.wrap (f) () -- make coroutine, resume it
+ return 0
end -- make
What do you think?