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

Using a table as __index in metatable does not work #7

Open
nrother opened this issue Mar 4, 2014 · 0 comments
Open

Using a table as __index in metatable does not work #7

nrother opened this issue Mar 4, 2014 · 0 comments
Labels

Comments

@nrother
Copy link
Owner

nrother commented Mar 4, 2014

Lua allows the metatables __index entry to be a table (and not only a function). In this case the value from the __index table is returned, if found. See http://www.lua.org/pil/13.4.1.html

With this contruct a request to any table entry from C# fails. Proof:

dynamic mt = lua.NewTable("mt");
mt.__index = lua("return { a = 5 }");
dynamic tab = lua.NewTable("tab");
tab.a = 4;
tab.SetMetatable(mt);
Console.WriteLine(tab.a); //crash
@nrother nrother added the bug label Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant