@@ -156,7 +156,25 @@ end -- function match
156
156
-- ----------------------------------------------------------
157
157
function make (f )
158
158
assert (type (f ) == " function" , " wait.make requires a function" )
159
- assert (GetOption (" enable_timers" ) == 1 , " Timers not enabled" )
160
- assert (GetOption (" enable_triggers" ) == 1 , " Triggers not enabled" )
159
+
160
+ -- More friendly failure, suggested by Fiendish
161
+ local errors = {}
162
+ if GetOption (" enable_timers" ) ~= 1 then
163
+ table.insert (errors , " TIMERS" )
164
+ end -- if timers disabled
165
+ if GetOption (" enable_triggers" ) ~= 1 then
166
+ table.insert (errors , " TRIGGERS" )
167
+ end -- if triggers disabled
168
+ if # errors ~= 0 then
169
+ ColourNote (" white" , " red" ,
170
+ " One of your scripts (in '" ..
171
+ (GetPluginInfo (GetPluginID (), 1 ) or " World" ) ..
172
+ " ') just did something that requires " ..
173
+ table.concat (errors , " and " ) ..
174
+ " to be enabled, but they aren't. " ..
175
+ " Please check your configuration settings." )
176
+ return nil , " Trigger/Timers not enabled" -- bad return
177
+ end -- if have errors
161
178
coroutine.wrap (f ) () -- make coroutine, resume it
179
+ return true -- good return
162
180
end -- make
0 commit comments