10000 feat: toNumeric and checkNumeric by robbielyman · Pull Request #173 · natecraddock/ziglua · GitHub
[go: up one dir, main page]

Skip to content

Conversation

robbielyman
Copy link
Collaborator

These functions rely (lightly) on Zig's comptime to minimize some of the annoying overhead of writing @intCast and @floatCast all the time by making those builtins part of the function definition. However, since those builtins assert in builds with runtime safety enabled, these functions will crash the program if called with bad Lua input. More discussion is warranted about the tradeoffs of going this route before merging.

Resolves #172.

@robbielyman
Copy link
Collaborator Author

(the CI failures on nightly for windows appear unrelated and touch on stuff that is actively being worked on in Zig master)

These functions rely (lightly) on Zig's comptime to minimize some of the
annoying overhead of writing `@intCast` and `@floatCast` all the time by
making those builtins part of the function definition. However, since
those builtins assert in builds with runtime safety enabled, these
functions will crash the program if called with bad Lua input. More
discussion is warranted about the tradeoffs of going this route before
merging.

Resolves #172.
@robbielyman
Copy link
Collaborator Author

@nurpax I'd appreciate your eyes :)

Copy link
Contributor
@nurpax nurpax left a comment

Choose a reason for hiding this comment

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

The semantics for the change are exactly as discussed. I did add some code comments though, since you asked. :) Nothing serious though.

@robbielyman robbielyman changed the title feat: add pushNumeric, toNumeric and checkNumeric feat: toNumeric and checkNumeric Aug 21, 2025
@robbielyman robbielyman merged commit bf9fc6e into main Aug 21, 2025
32 of 36 checks passed
@robbielyman robbielyman deleted the push-otvqzvtzzqum branch August 21, 2025 02:30
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.

pushInteger, checkInteger, pushNumber, checkNumber typing annoyances
2 participants
0