linc_wren

Haxe/hxcpp @:native bindings for Wren.
https://github.com/RudenkoArts/linc_wren

To install, run:

haxelib install linc_wren 0.0.1 

See using Haxelib in Haxelib documentation for more information.

README.md

linc/Wren

Haxe/hxcpp @:native bindings for Wren.

This is a linc library.


This library works with the Haxe cpp target only.


Example usage

See test/Test.hx

Be sure to read the Wren documentation
http://wren.io/

import wren.Wren;
import wren.WrenVM;
import wren.WrenHandle;

class Test {

    static function main() {
        var vm:WrenVM = Wren.newVM();

        var file:String = sys.io.File.getContent("script.wren");
        Wren.interpret(vm, file);

        Wren.ensureSlots(vm, 1);
        Wren.getVariable(vm, "main", "Call", 0);
        var callClass:WrenHandle = Wren.getSlotHandle(vm, 0);

        var noParams:WrenHandle = Wren.makeCallHandle(vm, "noParams");
        var zero:WrenHandle = Wren.makeCallHandle(vm, "zero()");
        var one:WrenHandle = Wren.makeCallHandle(vm, "one(_)");

        Wren.ensureSlots(vm, 1);
        Wren.setSlotHandle(vm, 0, callClass);
        Wren.call(vm, noParams);
        
        Wren.ensureSlots(vm, 1);
        Wren.setSlotHandle(vm, 0, callClass);
        Wren.call(vm, zero);
        
        Wren.ensureSlots(vm, 2);
        Wren.setSlotHandle(vm, 0, callClass);
        Wren.setSlotDouble(vm, 1, 1.0);
        Wren.call(vm, one);

        Wren.releaseHandle(vm, callClass);
        Wren.releaseHandle(vm, noParams);
        Wren.releaseHandle(vm, zero);
        Wren.releaseHandle(vm, one);

        Wren.freeVM(vm);
    }

}
Contributors
RudenkoArts
Version
0.0.1
Published
4 months ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github