Skip to content
/ SFHaxe Public

Transpile typed, null safe and powerful Haxe code for StarfallEx

License

Notifications You must be signed in to change notification settings

Vurv78/SFHaxe

Repository files navigation

SFHaxe Haxelib License: MIT Downloads github/Vurv78

Haxe library that adds StarfallEx bindings that are autogenerated in the generator branch.

Write Starfall scripts in the same typed, null safe and powerful language that many popular programs & games like Friday Night Funkin' are written in.

Example snippet

image

What is Haxe?

See what is haxe?, and a code sample here.
Long story short, it's a language that compiles to other languages while adding a lot of neat features to extend them.

Check out some of these features here.

Features:

  • Autogenerated bindings for every Library and Type in StarfallEx.
  • IDE Documentation so you don't have to get out of your editor to find out what a function does.
  • Some support for replacing Haxe standard library with sf friendly methods.

What would you use this for?

  • If you want typed, more powerful & easier to manage code.
  • If you don't want your source code to be stolen, this works as well since the source is transpiled into unrecognizable lua.
  • If you wanted to use all of Haxe's public libraries (see lib.haxe.org), which a good portion should be compatible with SFHaxe.

Installing

  • Get Haxe (Version must be > 4.2.0)
  • Install using Haxe's package manager haxelib: haxelib install sfhaxe
  • That's it!

Using SFHaxe

Look at examples/Basic Full for a full example.

Make a Haxe project, and in your build.hxml file add:

# Optional: Delete Unused Code
--dce full

# Link to sfhaxe.
--library sfhaxe

# Example Defines
--define SERVER # Can be SERVER, CLIENT or SHARED
--define NAME=A cool chip
--define SUPERUSER
--define AUTHOR=Vurv
--define MODEL=a/model/path.mdl

# Set the Haxe path to the current directory of the hxml + /src/
--class-path src

# Tell the compiler to generate lua code at this path local to %CD%
--lua bin/outscript.lua

# Set the main class to compile from. In this case, you have a file called Main.hx in /src/ that creates class Main.
--main Main

If you want Haxe bindings for GLua to make addons instead of Starfall scripts, check out gmodhaxe. (Not made by me so can't confirm how good it is)