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

luajit: opening standard library fails #64

Closed
rockorager opened this issue Feb 23, 2024 · 4 comments
Closed

luajit: opening standard library fails #64

rockorager opened this issue Feb 23, 2024 · 4 comments

Comments

@rockorager
Copy link

rockorager commented Feb 23, 2024

I know luajit support is in it's infancy but wanted to report that opening the standard libraries with it fails. I can swap out for 5.2 through 5.4 and openLibs or openBase work fine, but luajit fails:

/home/tim/.cache/zig/p/1220bc58b81db27e4a04f61703e0929fa3ec780a24698483aee1b349dee2cf9dd96a/src/lib.zig:2536:16: error: member function expected 1 argument(s), found 2
        try lua.loadFile(file_name, .binary_text);
            ~~~^~~~~~~~~
/home/tim/.cache/zig/p/1220bc58b81db27e4a04f61703e0929fa3ec780a24698483aee1b349dee2cf9dd96a/src/lib.zig:2652:5: note: function declared here
    fn loadFile51(lua: *Lua, file_name: [:0]const u8) !void {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@rockorager
Copy link
Author

Note: this does happen with 5.1 also. My original text said 5.1 worked but I have verified it doesn't (same error).

@natecraddock
Copy link
Owner

Hey!

that opening the standard libraries with it fails

Do you mean it segfaults/panics? I ran into this recently and I have a TODO comment to look into this more. If that's the case, I'll re-prioritize it and work on it sooner!

I think loadFile is one of the last functions that doesn't have test coverage (I just never got around to adding it). So I'll make sure to get that tested!

@rockorager
Copy link
Author

rockorager commented Feb 23, 2024 via email

natecraddock added a commit that referenced this issue Mar 19, 2024
The individual lua.load*() function where incorrectly loading the
libraries. The docs mention to use lua_call or requireF instead of
calling the function directly.

Closes #64
@natecraddock
Copy link
Owner

Turns out the functions for opening libraries aren't meant to be called directly. Thanks again for reporting this!

I made a separate issue for loadFile: #69

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

2 participants