Added a ~lua: prefix for flagging non-WML errors.
This commit is contained in:
parent
4ab0dcb758
commit
e5562a1b52
2 changed files with 9 additions and 1 deletions
|
@ -272,7 +272,9 @@ function wml_actions.lua(cfg)
|
|||
args.y2 = ev.y2
|
||||
table.insert(args, ev[1])
|
||||
table.insert(args, ev[2])
|
||||
assert(loadstring(cfg.code or ""))(args)
|
||||
local bytecode, message = loadstring(cfg.code or "")
|
||||
if not bytecode then error("~lua:" .. message, 0) end
|
||||
bytecode(args)
|
||||
end
|
||||
|
||||
function wml_actions.music(cfg)
|
||||
|
|
|
@ -392,6 +392,12 @@ bool luaW_pcall(lua_State *L
|
|||
m += 5;
|
||||
char const *e = strstr(m, "stack traceback");
|
||||
lg::wml_error << std::string(m, e ? e - m : strlen(m));
|
||||
} else if (allow_wml_error && strncmp(m, "~lua:", 5) == 0) {
|
||||
m += 5;
|
||||
char const *e = NULL, *em = m;
|
||||
while (em[0] && ((em = strstr(em + 1, "stack traceback"))))
|
||||
e = em;
|
||||
chat_message("Lua error", std::string(m, e ? e - m : strlen(m)));
|
||||
} else {
|
||||
chat_message("Lua error", m);
|
||||
ERR_LUA << m << '\n';
|
||||
|
|
Loading…
Add table
Reference in a new issue