Open ghost opened 3 years ago
Very cool! I didn't know about these micro frameworks.
__lua__
calls instead in a very isolated fashion?xpcall
is a vital mechanism for capturing exceptions. If it's not available on a given platform, you might just alias it to a dummy pass through function.It would be helpful to also see some problematic code from your end, perhaps I can be more specific with suggestions.
- Is there possibly a way you could handle this with low level
__lua__
calls instead in a very isolated fashion?
I wish but i would something like this in Haxe to get working
package;
import hxscrupp.Scrupp;
import lua.Table;
class Main {
public static function main() {
Scrupp.init("Scrupp", 640, 480, 32, false);
@:expose("main")
var main: lua.Table<String, haxe.Constraints.Function> = Table.create({
render: function(dt: Float) {
trace(dt);
}
});
}
}
Unfortunately, Haxe generates main
variable (Not the function) as local main
and that's what in my mind, I can do something like this and it's working :)
package;
import hxscrupp.Scrupp;
class Main {
public static function main() {
Scrupp.init("Scrupp", 640, 480, 32, false);
function render_func(dt: Float) {
trace(dt);
}
untyped __lua__("
main = {
render = render_func
}
");
}
}
But i somehow feel that this not good practice/idea i see, But it's last hope if gonna count on it...
xpcall
is a vital mechanism for capturing exceptions. If it's not available on a given platform, you might just alias it to a dummy pass through function.
Well all engines i mentioned has xpcall
support but the problem is in the exception detection due to how Haxe generates Lua code, To be honest i wish if there is build option that allows to embed code depending on target, For example MicroLua triggers errors when using xpcall
maybe because of being Lua modified...
Awaiting replies!
Hi everyone, Thanks for making Haxe! :)
I wish if Haxe's Lua backend would introduce/add these 2 because really good...
@luaNotLocal
can be used to disable generatinglocal
variables and just let them global, The purpose of this is to let some game engines/tools like Scrupp works because it does not allow game loop table to be local variable...lua_no_xpcall
can be helpful in casexpcall
does not work properly on Lua interpreter dev working with, In addition this can help making Haxe externs for Lua homebrews much easier, As MicroLua (3DS/NDS Lua homebrew) does not work withxpcall
and to get it working i was forced to edit last line of code to call main function with noxpcall
usage, The same even goes to Amulet i think so...Sorry if this issue not helpful, I ❤️ Haxe and i wish if i can get stuff working with no headache of editing generated code!
Thanks for reading and awaiting replies...