aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error_handling.moon3
1 files changed, 3 insertions, 0 deletions
diff --git a/error_handling.moon b/error_handling.moon
index b69b75f..207ed07 100644
--- a/error_handling.moon
+++ b/error_handling.moon
@@ -60,12 +60,15 @@ enhance_error = (error_message)->
-- Hacky: detect the line numbering
unless error_message and error_message\match("%d|")
error_message or= ""
+ -- When calling 'nil' actions, make a better error message
if fn_name = (error_message\match("attempt to call a nil value %(global '(.*)'%)") or
error_message\match("attempt to call global '(.*)' %(a nil value%)"))
action_name = fn_name\from_lua_id!
error_message = "The action '#{action_name}' is not defined."
+ -- Look for simple misspellings:
+
-- This check is necessary for handling both top-level code and code inside a fn
func = debug.getinfo(2,'f').func
ename,env = debug.getupvalue(func, 1)