moonscript
moonscript copied to clipboard
"in upvalue 'moonscript_chunk'" not correctly rewritten.
When running from cli tool moon, moonscript catches any error generated and rewrite its traceback's line number and the moonscript_chunk to main chunk.
This can be found in here, where chunk_func defaults to moonscript_chunk.
The pattern used to rewrite this is
"function '" .. chunk_func .. "'"
In moon, moonscript_chunk is referenced in run_chunk therefore becomes an upvalue when called.
So the pattern above won't work anymore.
Perhaps we should change it to something like this ?
rep = "(%d+): in %a+ '?" .. chunk_func .. "'?$"
traceback[#traceback] = traceback[#traceback]\gsub rep, "%1: in main chunk"