Repository navigation
Conversation
Lua strings are UTF-16 by default, so #"x" and string.sub differ from the reference implementation for non-ASCII text. With ByteStrings enabled every char holds one byte, files and standard I/O are read and written as raw bytes, character classes, upper and lower follow the C locale and string.char rejects values above 255. Default behavior is unchanged.
# Conflicts: # src/Lua/IO/FileSystem.cs
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.
Adds opt-in byte strings through
LuaPlatform.DefaultByteStringsandLuaStringMode.Bytes: Lua strings carry bytes, file and stream I/O preserve raw data, and string classes/case conversion follow ASCII C-locale rules. UTF-16 remains the default, and existing main public APIs remain compatible.The three original commits from #367 retain their authorship and hashes. This branch also includes the main fixes from #368.
LuaStringMode. Preserve existing constructors and stream-factory signatures; add mode-aware overloads.state.Load(module)for modules and share file-loading paths. Fix the recursive unbuffered Unity asset overload.UnityStandardIO/DebugLogStreamoverloads so byte-mode UTF-8 text displays correctly in Unity logs. Preserve the existing constructors and UTF-16 defaults.files.luabytes and byte-mode UTF-8 BOM checks; keep UTF-16 adaptations in that mode's harness. Vendored scripts are unchanged.Validation on Windows, .NET 8.0.32:
ExpectedFailurecategory, including 38 official-script runs. Existing unsupported reader loading, bytecode dumping and process execution remain excluded by the harness.Encoding.UTF8.Draft pending maintainer approval. Use a merge commit when approved to preserve the contributor's commits and indirect PR merge status.