LuaDardo
LuaDardo copied to clipboard
Unable to embed fennel
Hello,
Thank you for the interesting lib. I'm however unable to embed fennel (https://fennel-lang.org/setup#embedding-the-fennel-compiler-in-a-lua-application.)
I got this error instead
flutter: Err
flutter: >------ stack top ------<
flutter: >------ stack bottom ------<
flutter: NoSuchMethodError: Class 'String' has no instance method '-'.
Receiver: "9"
Tried calling: -("0")
This is how I embed fennel:
void loadLua() async {
String fennelSrc = await rootBundle.loadString('assets/fennel.lua');
String src = await rootBundle.loadString('assets/test.lua');
try {
LuaState ls = LuaState.newState();
_ls = ls;
ls.openLibs();
FlutterLua.open(ls);
FlutterWidget.open(ls);
ls.doString(fennelSrc);
ls.doString(src);
setState(() {
// _ls = ls;
});
} catch (e) {
print("Err");
_ls?.printStack();
print(e);
}
}
The problems looks like on Dart side, because this works
function getContent1()
return Row:new({
children={
GestureDetector:new({
onTap=function()
flutter.debugPrint("--------------onTap--------------")
print("Yay")
print(-("0"))
flutter.debugPrint("--------------again--------------")
end,
child=Text:new("click here")}),
Text:new("label1"),
Text:new("label2"),
Text:new("label3"),
},
mainAxisAlign=MainAxisAlign.spaceEvenly,
})
end
Thanks