I am writing Haxe bindings for Roblox’s Luau API for my roblox-hx library, which heavily depends on objects to run your Roblox games’ logic. While in Lua it’s generally acceptable to write fields in UpperCamelCase, this rule is not appropriate for Haxe programming so @:native must be used to cover up this problem, but it does not appear to be working on versions prior to Haxe 5.0.0-preview1 and even Haxe 5 itself.
No libraries or macros were used and no modifications to the standard library or to the compiler were made, only 2 defines were set:
-D lua-vanilla
-D lua-ver=5.1
Test project link
Am I doing something wrong? Or is something really broken behind the scenes?
I don’t think the current behaviour is correct. @:native
isn’t respected if the function itself is marked as extern:
extern class Native {
@:native("Native")
public static extern function native():Void;
}
function main() {
Native.native();
}
This gives:
___Main_Main_Fields_.main = function()
Native.native();
end
vs.
extern class Native {
@:native("Native")
public static function native():Void;
}
function main() {
Native.native();
}
which gives:
___Main_Main_Fields_.main = function()
Native.Native();
end
This bug also happens on the js target, and other targets, so it would be worth opening an issue on github.
That is really odd, but it works now. Tysm!