What does the “@” symbol do in Roblox scripting? I’ve recently been playing with strings and I accidentally typed “@exampleString” instead of “#exampleString”. I am unsure about its purpose and cannot find any other DevForum posts about this symbol.
This is a semi-new thing that was added to Luau called attributes. Currently, the only supported attribute is @native
which tells the compiler to compile it to native CPU code, instead of using the Luau VM.
Edit: if you want to use this attribute, place it at the top of the function you wish to compile natively:
@native
local function someFunction()
-- do a ton of calculations, will be compiled natively
end
Edit 2: There seems to be another undocumented attribute that I actually found just now, called @checked
. Although I don’t know much about this, I assume it signals to the type checker, perhaps in a --!nocheck
script, that you want to force a function to be checked, but don’t quote me on that. Just an assumption.
If you want to learn more about attributes, you can read the RFC proposal on the Luau RFCs Github repository:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.