So, throughout time I’ve witnessed the usage of certain comments in Luau but I cannot find any documentation about it.
So, we got our well-known comments such as…
--!strict
--!non-strict
Which configure how strict the type-checking is.
There’s the native comments…
--!native
Which is used to mark an entire module script for Native Luau compilation and alternatively you can place @native above an function statement to manually mark a single function for native compilation.
Example:
@native
function NativeLerp(a, b, c)
return a + (b - a) * c
end
(Theoretically this function should now be nearly as fast as if it were written in C++.)
Now about all the undocumented / lesser-known flags.
I’ve only seen this flag a few times
but placing --!optimize [Number] (I could have typed it wrong) at the beginning of a script forces a certain optimization level for a script?
The default for studio is level 1 and for live games it’s level 2 unless I’m missing something.
This is all I found really.
Where can I find more about flags like these? What’s the highest possible level? Can I use things like this in live games?
I wish to make use of Luau’s full potential and explore all the available comments/flags that can be placed at the start of a script but I don’t even know where to look.
Even Luau’s official site barely mentions any of these things existing at all unless my eyes skipped over something.
I wish there was more info and documentation on this, any help is greatly appreciated!
Here’s the full list of flags (or “hot comments”) the Linter recognises:
i.e. If you enter a comment such as --!fixmycode, it’ll check if it’s in the list, and since it isn’t, it’ll give you a linting warning and an orange underline.
Doing some analysis of the code above this section, we can also see the valid arguments for some of them:
nolint may optionally receive the Lint name to disable, taken from this list:
optimize expects 0, 1 or 2. Here is the explanation, in the code, of the effects of each of them: