Skip to content

Navigation Menu

Sign in
Sign up

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

Open
Labels

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /