Luau Whitespace

What is considered valid white space by Luau, Roblox’s implementation of Lua?

I know spaces, horizontal tabs, and newline as well as carriage return are considered valid white space, but are other forms of whitespace (vertical tabs, form feeds, et cetera) valid like they are in standard Lua?

I would test through a script’s source but currently running tests for other projects on Linux, so that’s a yikers.

Any help is appreciated!

I’ve written a few Lua lexers and I’ve only ever encountered space, tab, newline, and carriage return.

You could try different bytes by running something like this in the command bar:

for i = 0, 32 do
    local m = Instance.new("ModuleScript")
    m.Source = string.char(i) .. "return 1"
    print("Byte", i, (pcall(require, m)))
    m:Destroy()
end

I’m on phone so I’m not of much help :stuck_out_tongue:

Edit: Looks like the characters {9, 10, 11, 12, 13, 32} are valid whitespace, so that includes horizontal tab and vertical tab.

2 Likes

Thanks! I just did some testing too and it seems Roblox Studio deviates from the Unicode standard seeing that while carriage return and line feed are valid line terminators, vertical tab and form feed is not.

Also, strangely enough, vertical tab is rendered as a character!

hm

Edit: It appears Roblox Studio doesn’t render form feed too \f, so you can do this:

not-right

…and it will run right.