Open
Description
When runtime encoding is None, lua.table(foo=132)
creates a Lua table with userdata as a key. There is a workaround (use lua.table_from
which supports dicts with binary keys). But I think it makes more sense to use Lua strings for keys for tables created by lua.table
, even if the encoding is None. I expect this to work even if encoding is None:
from lupa import LuaRuntime
lua = LuaRuntime(encoding=None)
tbl = lua.table(x=1)
# this should print 1, but it prints 'nil'
lua.eval("function(tbl) print(type(tbl.x)) end")(tbl)
# this prints
# userdata number
lua.eval("function(tbl) for k,v in pairs(tbl) do print(type(k),type(v)) end end")(tbl)