-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Lua.ToString changes stack if callMetamethod is true #46
Comments
Can confirm the issue. The stack was behaving in an unusual way for me, so I changed the indexes to be absolute as a quick fix. |
Yes. Is a know issue. Not sure what is the best solution in this case, maybe remove the value from stack when |
The expectation that I had is that ToString would leave the stack in the original state before the call, regardless of any parameter values. The fact that it changes the stack depending on parameter values is very unexpected. |
Fixed: 3cb7a26 Thank you for the report. |
When using Lua.ToString(index), I was getting unexpected behaviors. I determined that Lua.ToString(index, true) was adding a value to the Lua stack.
After investigation, I discovered that Lua.ToString(index, true) ends up ultimately calling luaL_tolstring in Lua.ToBuffer, which pushes a value onto the stack in addition to returning the buffer value.
My expected behavior of a function called ToString(index) is that it simply returns a string value without modifying the Lua stack, especially since calling ToString(index, false) does not change the Lua stack.
Regards,
JPG
The text was updated successfully, but these errors were encountered: