Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua.table keyword arguments are misleading when runtime encoding is None #66

Open
kmike opened this issue Oct 28, 2015 · 0 comments
Open

Comments

@kmike
Copy link
Collaborator

kmike commented Oct 28, 2015

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants