RBXHaxe - Haxe Library for Roblox

O well, impeccable timing. There was a syntax error in the generated file for RunService.

Run:
haxelib update RBXHaxe

1 Like

You keep talking about ā€œcastingā€ but what actually is that?

Do you have a discord I can talk to you on?

Yea, I canā€™t post it because this is a public section. Iā€™ll DM you it.

Not suree if youā€™re still maintaining this (1.5 years later) but trying to build it when including anything Roblox gives me this error

/usr/local/lib/haxe/lib/RBXHaxe/3,1,2/PVInstance.hx:7: characters 20-31 : Missing ;

Sorry for the delay, updated to fix this and update the API.

2 Likes

Hi, love the project!
Trying to get it set up, haxe build.hxml runs fine with this .hx source,

class HelloWorld {
    static public function main() {
        trace(SurfaceType.Smooth);
    }
}

and this build.hxml:

-D lua_ver 5.1
-D LuaVanilla
-lib RBXHaxe
--macro includeFile('LibLoader.lua')

--class-path src/server
--lua bin/server/HelloWorld.server.lua
--main HelloWorld

This results in the following Lua code:

HelloWorld.main = function() 
  __haxe_Log.trace(RBXEnum.SurfaceType.Smooth, _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="src/server/HelloWorld.hx",lineNumber=4,className="HelloWorld",methodName="main"}));
end

which give this error:

  runtime error:
 ServerScriptService.Server.HelloWorld:539: attempt to index nil with 'SurfaceType'  -  Server - HelloWorld:131
  ServerScriptService.Server.HelloWorld:135 function _hx_error
ServerScriptService.Server.HelloWorld:539
ServerScriptService.Server.HelloWorld:842
  -  Server - HelloWorld:135

because thereā€™s no RBXEnum global. Is this a bug or am I doing something wrong?


Installed RBXHaxe by following instructions in RBXHaxe/README.md at master Ā· EmptySetRBLX/RBXHaxe Ā· GitHub and then the steps outlined in the OP

Hi, I have updated the OP. Sorry about that. You need to update your LibLoader.Lua file to contain

_G.table = table
require = require(game.ReplicatedStorage:WaitForChild(ā€œNevermoreā€))
local globalEnv = getfenv()
local RBXEnum = globalEnv[ā€œEnumā€]
setmetatable(_G, {__index = (function(t, i) return globalEnv[i] end)})

Honestly I would like to refactor this not to have to use a metatable at all at some point, but this should get you working.

1 Like

Ahh this is so cool it works now, canā€™t wait to try a project!