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

Overloaded functions bug #103

Closed
umby24 opened this issue Sep 5, 2014 · 1 comment
Closed

Overloaded functions bug #103

umby24 opened this issue Sep 5, 2014 · 1 comment

Comments

@umby24
Copy link

@umby24 umby24 commented Sep 5, 2014

In C#, I have an overloaded function, GetBlock(int) and GetBlock(string), which I am providing to Lua to be used.

If I run GetBlock(int) multiple times from lua, it is fine. However, once I have used the string overload, I can no longer use the int overload. It will default to the string overload every time.

Example code:
local newblock = G_Blocks:GetBlock(1)
local newblock2 = G_Blocks:GetBlock("Stone")
local newblock3 = G_Blocks:GetBlock(1)

newblock and newblock2 will function properly, but newblock3 will be attempting to run the string overload rather than the int.

@gh-canon
Copy link

@gh-canon gh-canon commented Feb 15, 2018

I'm seeing similar behavior with overloads involving params object[] values, e.g.:

Bar Foo(IEnumerable enumerable)
{
  ...
}
Bar Foo(NLua.LuaTable luaTable)
{
  ...
}
Bar Foo(params object[] values)
{
  ...
}

As soon as that third overload is selected, that's all the lua environment will ever use. Up until that point, the appropriate overloads are selected, contextually.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.