can not eval ... varargs in lua5.4.x
Closed this issue · 5 comments
sonyps5201314 commented
pkulchenko commented
@sonyps5201314, thank you for the report. It looks like Lua 5.4 changed the name of those variables from (*vararg)
to (vararg)
.
This patch should fix this:
diff --git a/src/mobdebug.lua b/src/mobdebug.lua
index dc4ea68..b5a59c0 100644
--- a/src/mobdebug.lua
+++ b/src/mobdebug.lua
@@ -303,8 +303,7 @@ local function stack(start)
i = 1
while true do
local name, value = debug.getlocal(f, -i)
- -- `not name` should be enough, but LuaJIT 2.0.0 incorrectly reports `(*temporary)` names here
- if not name or name ~= "(*vararg)" then break end
+ if not name then break end
locals[name:gsub("%)$"," "..i..")")] = {value, select(2,pcall(tostring,value))}
i = i + 1
end
@@ -439,8 +438,7 @@ local function capture_vars(level, thread)
else
name, value = debug.getlocal(level, -i)
end
- -- `not name` should be enough, but LuaJIT 2.0.0 incorrectly reports `(*temporary)` names here
- if not name or name ~= "(*vararg)" then break end
+ if not name then break end
vars['...'][i] = value
i = i + 1
end
sonyps5201314 commented
Yes, it works now! Thank you for fixing it so quickly.
sonyps5201314 commented
It seems that this feature is not supported in Lua5.1, not LuaJIT.
pkulchenko commented
Correct; it looks like Lua 5.1 didn't provide access to varargs through getlocal
.
sonyps5201314 commented
Okay, thanks.