Haxe Lua target: dependencies

Hello everyone,

I am relatively new to the Haxe world but I enjoy the language a lot so far. Currently I am investigating the possibility to create externs for the Gideros Game Framework which uses Lua and - I think - would fit quite nicely with a Haxe-based development workflow. However, I have trouble getting even a short test to work. The main problem seems to be with the dependencies necessary.

Compiling a very simple Haxe script to Lua:

class Game {
	static public function main() {
		trace('Hello World');

with the build.hxml:

-cp src
-lua main.lua
-main Game

does indeed create a potentially good-looking main.lua. However, it seems to require a few dependencies (as detailed in the manual) that need to be installed using luarocks. As Gideros is mainly its own platform unaware of luarocks, running the script fails with: main.lua:53: module 'lua-utf8' not found.

What options do I have now? Is it possible to somehow exclude the lua-utf8 dependency from the compilation or do I need to get Gideros to satisfy it (by either including it or making it aware of the luarocks folder)? Or am I missing something? I tried to get inspiration from the hxdefold project but can’t find anything related to my problem. How did they solve that (maybe Defold includes all dependencies already?).

Thanks a lot and again: Haxe is pretty great, I enjoy it a lot more than Typescript which I normally use, so it is a pity it is not more popular. Great work!

Try this build command.

-D lua-vanilla

It seems to work! Awesome, thanks.

Is that command documented somewhere? Maybe there are others that prevent future questions from my side… :wink:

1 Like

You can find it in the lua section of the manual Version flags - Haxe - The Cross-platform Toolkit

1 Like

Alright, not well hidden… I somehow missed it. Thanks!

There are a bunch of other not lua-specific flags, which you may find useful: Global Compiler Flags - Haxe - The Cross-platform Toolkit