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

LuaTable instance is passed to Methods #4

Open
nrother opened this issue Mar 3, 2014 · 1 comment
Open

LuaTable instance is passed to Methods #4

nrother opened this issue Mar 3, 2014 · 1 comment

Comments

@nrother
Copy link
Owner

nrother commented Mar 3, 2014

When a C#-Method is called with a table as a parameter, a instance of LuaTable is passed not a instance of DynamicLuaTable.
Currently there is no idea how to change this, the only solution would be a wrapper Method, wrapping the in the correct classes.

This would be a workarround, but it requires a reference to the orignal LuaInterface Assembly:

lua.func3 = new Action<dynamic>((table) =>
{
       table = new DynamicLuaTable(table, lua.LuaInterpreter);
       Console.WriteLine(table.num);
});
lua("func3({num = 42})");
@nrother
Copy link
Owner Author

nrother commented Mar 3, 2014

Just to makes this more clear: In the code given above the table in func3 is of the type dynamic with the underlying type LuaTable (instead of DynamicLuaTable). This means, you can't use table.num (but table["num"] works.)

Rewrapping the table as shown above is a workaround. Or just use the array syntax...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant