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

Enums and slices support #60

Merged
merged 10 commits into from
Feb 21, 2024
Merged

Conversation

VisenDev
Copy link
Contributor

I've added support for both slices and enums in my generic push and pop functions

@VisenDev
Copy link
Contributor Author

hmm it seems not all versions of lua have the "lua_len" function, I may have to find a work around

src/lib.zig:1170:10: error: root struct of file 'cimport' has no member named 'lua_len'

@VisenDev VisenDev marked this pull request as draft February 10, 2024 02:51
@VisenDev
Copy link
Contributor Author

VisenDev commented Feb 10, 2024

TODO:
DONE - finish pushSlice implementation
DONE - audit all pointer processing functionality to make it less messy. Pointers have quite a bit of nuance in how they should be converted. (I underestimated this so I didn't really implement it with an overarching plan in mind)
DONE - see if there is a way to avoid the extra memory duplication in toSlice (this would require a lua version agnostic len function)

@natecraddock
Copy link
Owner

hmm it seems not all versions of lua have the "lua_len" function, I may have to find a work around

src/lib.zig:1170:10: error: root struct of file 'cimport' has no member named 'lua_len'

I'll take a closer look tomorrow, but you can use lua_rawlen or lua_objlen in older versions of Lua.

I would use lua_objlen and lua_rawlen specifically in this case, because both bypass metamethods iirc

@VisenDev VisenDev marked this pull request as ready for review February 10, 2024 16:24
Copy link
Owner

@natecraddock natecraddock left a comment

Choose a reason for hiding this comment

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

Just a couple things, everything else looks good!

src/lib.zig Outdated Show resolved Hide resolved
src/lib.zig Outdated Show resolved Hide resolved
@natecraddock natecraddock merged commit 2ced050 into natecraddock:main Feb 21, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants