lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've noticed that it is possible to use 'debug.setlocal' inside of a table constructor to modify the stack value in which SETLIST will write to. By using this function you can overwrite the table in the stack to be other values, or just values that aren't tables at all. When setting the value to something other than a table, instead of erroring, Lua will crash. The only version I tested that this does not crash (nor error) on is 5.1, but on the latest Lua release it crashes:

local _ = {debug.setlocal(1, 1, nil)}

The following code should error and not crash.

Also, if the value is changed to another table (ex: {debug.setlocal(1, 1, {})}), should the intended behavior be for SETLIST to write to the original table, or the new table set by debug.setlocal? (currently, it will write to the table set by debug.setlocal)


-- bmcq