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

Many changes to String and Bytes functions #72

Merged
merged 7 commits into from
Mar 20, 2024
Merged

Conversation

natecraddock
Copy link
Owner

The commit messages should hopefully be clear. This renames functions that use "Bytes" in the name to "String" and any function that used "String" to refer to zero-terminated strings to be "StringZ".

Also cleans up a few places where [*:0] or [:0] were misplaced.

Part of #37

This is more conventional in the Zig standard library, and it allows us
to now rename the pushBytes function to pushString to make it more
discoverable
The toBytes function can always be replaced with toString now. Although
it is useful to have two push functions (one for slices and one for
zero-terminated slices), when returning a value from Lua, always having
a zero-terminated Zig slice with a length is useful.
For the same reasons as described in previous commits, these functions
can be removed in favor of the String versions
* addString -> addStringZ
* addBytes -> addString
There are a few cases where we can use a [:0] instead of a [*:0] to be
less restrictive.
I can't think of a better name at the moment, but at least this is an
improvement
@natecraddock natecraddock merged commit 6a75ad1 into main Mar 20, 2024
3 checks passed
@natecraddock natecraddock deleted the string-bytes-z branch March 20, 2024 14:37
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.

1 participant