Luau is a whitespace agnostic language so you can, but it’ll have to be before the local. So something like this does work just fine:
@native local function foo()
end
but something like this will not:
local @native function foo()
end
This is just because of how Luau is parsed. There’s no difference between local @native; function foo() end and local @native function foo() end to the parser, which means that you can’t tell whether it’s valid syntax or a bug.
Sometimes fixes or changes gets marked as live even when they’re not, for example this bug fix got marked as live even though it’s not rolled out yet. This can be very confusing and misleading especially since no Roblox engineer responded to the bug report of this issue in the devforum.
I always love to see the new changes made to Roblox Studio. The teams have brought amazing features in the past months, and I look forward to the future!
You can see that the second image is a lot more clearer and of more quality than the first one. The textures on the characters are blurrier in the first image and so is the logo of the game which is a GUI.
Attributes are a feature of Luau that allows you to add what’s essentially metadata to functions. You can read the RFC for it here but it’s a bit technical in nature. The idea is that you’ll be able to control things like the compiler and script analyzer a bit better using them.
The @native attribute (proposed in this RFC) is the first of these attributes and it allows you to tell the compiler to make a specific function compile with ‘native code generation’. You don’t need to know the exact details, but the idea behind native code generation is that it will make code very fast by making it run directly on the CPU instead of inside the Luau interpreter.
Not every function benefits from native code generation though. It mostly impacts very math-heavy code. Even if the code doesn’t get anything from it though, it adds some extra memory usage and extra startup time to the code. So, it’s desirable to only natively compile the functions that actually benefit from it. Thus, @native!