Many changes to String and Bytes functions#72
Merged
natecraddock merged 7 commits intomainfrom Mar 20, 2024
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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