andreirudenko / linc_luajit Goto Github PK
View Code? Open in Web Editor NEWHaxe/hxcpp @:native bindings for LuaJIT.
License: Other
Haxe/hxcpp @:native bindings for LuaJIT.
License: Other
I get this error when building the "test" project. Aren't you supposed to target cpp?
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,
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.
i used homebrew to install it idk if that will work but here you go
google drive
cause i think you don't really need the libs i think its just that you need only the paths
i have tried to look into this but i can't seem to find any answers please help me
what if i send you the errors that i get on my macos then you can fix it
can this do the same thing as your linc_luajit?
If someone have compiled luajit on linux or mac, please send me files or make pr. Thanks ;)
Add documentation
/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) {
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:
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"/>
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
In some files it tries importing ../lib/lua/...
L in Lua needs to be capitalised for it to work
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.