Git Product home page Git Product logo

linc_luajit's People

Contributors

andreirudenko avatar endes0 avatar gaminbottomtext avatar majigsaw77 avatar mcagabe19 avatar sirox228 avatar snirozu avatar tgpholly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

linc_luajit's Issues

Crash on callback run

Hello!

linc_luajit works fine, and I'm able to run some stuff (like print("hello world!") or print(5+5))
But then I add a callback as such:

var vm:State = LuaL.newstate();
LuaL.openlibs(vm);

 Lua_helper.add_callback(vm, "test", function() {
    return 2 + 2;
 });

after which it crashes the application without any visibile error.
i can do print(test) which will return something like "function: 0x0cd84058"
but calling it causes it to crash.
I don't know where to even start debugging this or collecting information that could possibly help debug this.

With kind regards,

callback from lua_register()

I didnt know how to make callbacks directly from lua_register function. But i found some examples in linc_sdl and linc_ogg.
SDL init_event_watch() cpp
SDL init_event_watch() hx
they are using StringMap and after any callback searching by id in Map.
Is there way to set callback directly to function.
there is cpp function whitch works with lua_register()

        static int luaCallback(lua_State *L){
            return 0;
        }

linc_lua lua_register() hx
Is there way to do it with haxe ?

upd:
also there is example of callback from hx-lua haxe_callback & func decl
and with this wrapper i can make callback like this:

        lua.setVars( {
            GetEntityPos:
                function(_name:String) {
                    var ent:Entity = Luxe.scene.get(_name);
                    return { x : ent.pos.x, y : ent.pos.y};
                }
        });
        lua.setVars( {
            SetEntityPos:
                function(_name:String, _x:Float, _y:Float) {
                    var ent:Entity = Luxe.scene.get(_name);
                    ent.pos.set_xy(_x, _y);
                }
        });

and this is works well with variable numbers of arguments
i was looking in hxcpp what is he doing with variable arguments, and looks like he pushing in haxe "stack" (like in lua) arguments and then call function.
What i want, is just make linc_lua work just like with hxcpp AutoGCRoot with callbacks.

I can make callback from lua, and in haxe get function from StringMap by name. But i dont know how to call functions with variable number of arguments. And maybe is there another better way.

macOS build errors

what if i send you the errors that i get on my macos then you can fix it

can you please fix this

/usr/local/lib/haxe/lib/linc_luajit/0,0,4/linc/linc_lua.cpp:65:25: warning: comparison of array 'dbg.short_src' not equal to a null pointer is always true [-Wtautological-pointer-compare]
if (dbg.short_src != NULL) {
~~~~^~~~~~~~~ ~~~~
/usr/local/lib/haxe/lib/linc_luajit/0,0,4/linc/linc_lua.cpp:69:37: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
if (dbg.linedefined != NULL) {
~~~~~~~~~~~~~~~ ^ ~~~~
/usr/local/lib/haxe/lib/linc_luajit/0,0,4/linc/linc_lua.cpp:73:41: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
if (dbg.lastlinedefined != NULL) {
~~~~~~~~~~~~~~~~~~~ ^ ~~~~
/usr/local/lib/haxe/lib/linc_luajit/0,0,4/linc/linc_lua.cpp:94:37: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
if (dbg.currentline != NULL) {
~~~~~~~~~~~~~~~ ^ ~~~~
/usr/local/lib/haxe/lib/linc_luajit/0,0,4/linc/linc_lua.cpp:100:30: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
if (dbg.nups != NULL) {

Building through lime on linux fails

No idea if i'm doing this wrong but I've been stuck on this for a while now.

When using lime test linux -verbose everything compiles and works just fine except the linking, which fails with this:
image

even though when testing the path it actually DOES exist

Not sure if this is me being stupid or an issue on this lib that's smth weird with lime.

Also, this only happens on mac/linux, windows builds fine and work perfectly.

Edit:
The only way I've gotten this to work on lime, is to put these in the project.xml btw:

	<haxedef name="NO_PRECOMPILED_HEADERS" />
	<haxedef name="LINC_LUA_RELATIVE_DYNAMIC_LIB"/>

HTML5 compilation

I can't compile to HTML5, get this error:

/usr/share/haxe/lib/linc_luajit/0,0,2/llua/Lua.hx:492: characters 43-61 : Abstract<cpp.Callable> has no field fromStaticFunction
/usr/share/haxe/lib/linc_luajit/0,0,2/llua/Lua.hx:526: characters 42-60 : Abstract<cpp.Callable> has no field fromStaticFunction

With Haxe there is issue

In some files it tries importing ../lib/lua/...
L in Lua needs to be capitalised for it to work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.