Skip to content

Conversation

@moxie-coder
Copy link
Collaborator

This will need EXTENSIVE testing btw to make sure most mods still work and such, because despite it still being luaJIT, it's an different implementation

This will need EXTENSIVE testing btw to make sure most mods still work and such, because despite it still being luaJIT, it's an different implementation
@moxie-coder moxie-coder added the lua modding You made an .lua script, aka softcode(d), label Nov 2, 2025
@moxie-coder moxie-coder marked this pull request as draft November 2, 2025 19:02
@moxie-coder
Copy link
Collaborator Author

I've also heard this was better over linc_luajit too, and this is part of how I'm hoping to fix compatibility with 0.6 mods, since I do have an build of my own mod, that uses hxlua with 0.6.3

@JordanSantiagoYT
Copy link
Owner

same as the first lua refactor:
works as intended, but runHaxeCode is just. dead

@moxie-coder
Copy link
Collaborator Author

same as the first lua refactor: works as intended, but runHaxeCode is just. dead

So no difference essentially, gotcha then

Copy link

@HomuHomu833 HomuHomu833 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        public static function addCallback(l:State, name:String, func:Dynamic)
        {
-               // PsychLua expects the function to be null for local callbacks, too lazy to do something about that
-               if (Type.typeof(func) != TFunction || func == null)
-                       return;
-
-               callbacks.set(name, func);
+               // PsychLua expects the function to be null for local callbacks so if func is not TFunction we don't add the callback here
+               if (Type.typeof(func) == TFunction)
+                       callbacks.set(name, func);

                Lua.pushstring(l, name);
                Lua.pushcclosure(l, cpp.Callable.fromStaticFunction(handleCallback), 1);

Simplifies the addCallback method by only adding the callback if the provided function is of type TFunction, aligning with PsychLua's expectations and removing unnecessary null checks.

Co-Authored-By: Homura <[email protected]>
@moxie-coder
Copy link
Collaborator Author

@JordanSantiagoYT try it now I guess

@moxie-coder
Copy link
Collaborator Author

I would like to say that some haxe errors are from the compilation error, I don't often comment much and just use the engine on my mods when I'm not doing work or touching grass on beautiful days but it that time it failed to compile 4 times. After it was recompiled the 5th time, a couple things slightly broke so if you gain a lot of more haxe errors. I'll link the last build that worked. Though it's before 48 so you would have to reoptimize the code and reimplement custom variables so ofc I'll be waiting but I dought it be a big deal unless something big planned doesn't work after multiple attempts...

What does this have to do with the PR?

@moxie-coder moxie-coder marked this pull request as ready for review November 21, 2025 02:11
@moxie-coder
Copy link
Collaborator Author

moxie-coder commented Nov 21, 2025

I might just merge this just because of two reasons, as I've said before, linc_luajit isn't really maintained anymore, and it's very old. And hxluajit is made by the same guy who's made just about almost all the libs this engine uses now (hxvlc, hxdiscord_rpc, hxnativefiledialog etc.) while also hearing good things about this too. Plus with HScript being broken and shit, it probably can't be made worse then it already is with this

@moxie-coder moxie-coder merged commit 8cc4f64 into main Nov 21, 2025
4 checks passed
@moxie-coder moxie-coder deleted the refactor/hxluajit branch November 21, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lua modding You made an .lua script, aka softcode(d),

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants