kyren / piccolo

An experimental stackless Lua VM implemented in pure Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiline strings aren't removing the initial newline

Jengamon opened this issue · comments

Found a thing:

print "---"
print [[
Random
]]

This prints

---

Random
 

in Piccolo, but

---
Random
 

in Lua.

From the Lua Reference Manual "Literal strings can also be defined using a long format enclosed by long brackets. [...] Literals in this bracketed form can run for several lines, do not interpret any escape sequences, and ignore long brackets of any other level. Any kind of end-of-line sequence (carriage return, newline, carriage return followed by newline, or newline followed by carriage return) is converted to a simple newline. When the opening long bracket is immediately followed by a newline, the newline is not included in the string."

This and a related issue should be fixed by 7405b4e