Luahscript is a Haxe library that uses hscript to parse and execute Lua scripts. The project is still under development, but already supports compilation on multiple platforms.
- Uses hscript to parse Lua scripts
- Supports compilation on multiple platforms: C++, Neko, Interp, JavaScript, and more
- Provides complete Lua syntax support, including variables, control structures, functions, and tables
- Supports metatables and metamethods
- Offers error handling and debugging capabilities
Install Luahscript using haxelib:
haxelib install luahscript
If you need to experience new features, you can download lib in github:
haxelib git luahscript https://github.com/VapireMox/luahscript
Here's a simple example showing how to parse and execute a Lua script:
import luahscript.LuaInterp;
import luahscript.LuaParser;
import luahscript.exprs.LuaExpr;
import luahscript.LuaAndParams;
class Main {
public static function main() {
var input:String = 'local apple, banana = ...; return apple .. " and " .. banana';
var interp = new LuaInterp();
var parser = new LuaParser();
final e:LuaExpr = parser.parseFromString(input);
// Get A Function By Default.
final func = interp.execute(e);
// You can input paramters for function and will return result what the class "LuaAndParams" by default.
final result:LuaAndParams = cast func("apple", "banana");
trace(result.values[0]); // apple and banana
}
}
Contributions are welcome! Please follow these steps:
- Fork this repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a Pull Request
Luahscript is released under the Apache 2.0 License. See the LICENSE file for details.