Skip to content

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

@nrother

Description

@nrother

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions