Open djfjfofoc3 opened 2 years ago
P.S. If all of the above are correctly implemented, this script should format without erroring:
type Str_Repeat = (string,number)->string; -- Type Definition using `type` keyword
local str_repeat: Str_Repeat = function(str, count)
local str2 = "";
for _ = 1, count do
str2..=str; -- Compound Operator
end
return str2;
end;
local notOp = function(someBool:boolean) -- Type def using inline-parameter-stuff
return if someBool then false else true -- If-then-else Expressions
end
for i=0,20,1 do
if i==10 then
continue; -- Continue statement
end;
end;
print(
str_repeat(
tostring(
notOp(true)
) .. '\u{22}', -- String Literals
0x000_00F -- Number Literals
)
);
This seems like require a new project (or fork from lua-formatter) to implement.
Luau is a fork of Lua 5.1, primarily used by Roblox, but also used by other projects. Now Luau adds to the Lua 5.1 syntax in ways this project doesn't support. An example of this is it's type checking, which is typescript-alike in syntax, and a basic example of it can be found here:
This issue is basically me requesting support for Luau-syntax for this repo.
Useful Resources related to this:
Checklist:
\x
), Unicode (\u
) and\z
escapes (docs)0b0101010101
,1_048_576
,0b_010_101
,0xFFF_FFF_FFF
(docs)continue;
(docs)a+=1
,a-=1
,a/=2
,a*=64
,a%=5
,a^=5
,a..="yeet"
(docs)local x: number = 69420;
(docs: 1/2, 2/2)local maxValue = if a > b then a else b
,local sign = if x < 0 then -1 elseif x > 0 then 1 else 0
(docs)I would personally really like if any, if not all of these are added to the project, since I hate converting code that uses these, to code that doesn't, just to make the formatter not complain.
Sincerely, - Mokiy