-
Notifications
You must be signed in to change notification settings - Fork 384
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
Move to NLua/KeraLua #3361
Move to NLua/KeraLua #3361
Conversation
Most things seem to work fine now? I had to remove a yield that was placed in stop that resolved some earlier issue, as it now just causes NREs (something NativeWindow callback was garbage collected? not sure what's going on). May not be needed anymore (need to check). There seems to be an interesting quirk with the console window. If you put in print("foo") (or some other printing command), it prints foo out then nil. Internally this is actually console.log(print("foo")). In old Lua print returns nothing, and outputs is null, and thus that console.log doesn't output anything. But now with newer lua versions outputs contains 1 element with simply null, and thus nil is outputted. Not sure what's the proper way to deal with this, should we treat outputs with one null the same as no return? |
How does it directly print tables now? |
Lua does not have void returns, so yes. |
before:
(both kinds have an extra blank line)
(those are tabs) |
Was the table dumper our custom thing? Regular lua can't unwrap tables when printing, and something similar seems to be the case with that new thing. |
The table dumper was custom in hawk. The outputs of the Log function would contain a raw LuaTable, which we have custom code to turn that into a string. It seems however that outputs just contains only the values of a LuaTable rather than the raw LuaTable itself, so NLua might be unpacking it now? |
Seems the unpacking stuff is just "normal" upstream behavior, not unpacking seems to be something tacked on by @zeromus. The source of the hacked NLua doesn't seem available, so not sure what exactly we could even submit to upstream to "fix" this. |
should be here |
…resting as generally we'd expect a user to have a table with only longs, although maybe they'll put a double in with some wonky math? if a double is in the table there will probably be an InvalidCastOperation, might not be nice for a user if they put in doubles for some reason
Hmm, suppose might be a good idea to just keep forking off NLua and just update our fork. I'd like to PR some of these changes anyways to upstream and hopefully have them accepted to we can just NuGet them and not worry about maintaining a fork, although no telling when they do their next release. @zeromus Could I be given write access to our NLua fork? |
done |
…l), add the yield on close back in (just needs to check if lua script is actually running ok)
Turns out most of our changes in NLua are already implemented upstream/not needed in NLua/irrelevant, only the Lua table unpacking differs in our fork. Probably easy enough to swap over to NuGet after upstream has that fixed (I plan on making a PR to add a switch for disabling that unpacking) and a new release is out. Still, what's here should suffice for our purposes, although might want to do some checking before merging this here. |
I'd like to see regression tests implemented on master before merging this. |
…fe for threads, ReferenceEqual should be good enough for our purposes though?)
This is a moonshot update to our NLua, which now uses KeraLua / native Lua 5.4. Some things work here, a lot of things just crash horribly. A bit of refactoring might be needed here? See #2260 and #2261