Skip to content

Fix a small compile issue with latest Crystal version + Bug with non-ascii strings and comments - #45

Merged
veelenga merged 3 commits into
veelenga:masterfrom
anykeyh:master
Aug 9, 2026
Merged

Fix a small compile issue with latest Crystal version + Bug with non-ascii strings and comments#45
veelenga merged 3 commits into
veelenga:masterfrom
anykeyh:master

Conversation

@anykeyh

@anykeyh anykeyh commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

This fix two issues:

  • Use as for forcing a type resolution that prevented compiling (one liner)

More important:

Fix non-ASCII chunks being truncated on load

Stack#run(String) passed buff.size (codepoint count) to
luaL_loadbufferx, which expects a byte length. Any chunk containing
multibyte UTF-8 was silently truncated by (bytes − codepoints), surfacing
as a spurious <eof> / unfinished string syntax error at the chunk
tail rather than at the offending character.

The fix was trivial:

Use #bytesize instead of #size.

I added regression specs covering Latin-1 supplement (é), Thai, CJK, em-dash, multibyte bytes inside string literals, and multibyte tails for good measure.

I wasn't able to run ameba, idk why but the binary wasn't compiling; although it should be fine in code-styling.

@veelenga
veelenga merged commit 61323f3 into veelenga:master Aug 9, 2026
1 check passed
@veelenga

veelenga commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Thanks

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