0

Iam trying to excute an lua script in android studio for this i used Luaj library from http://www.luaj.org/luaj/3.0/README.html? .

String script = "assets/hello.lua";
    Globals globals = JsePlatform.standardGlobals();
    LuaValue chunk = globals.loadfile(script);
    m.setText(chunk.call( LuaValue.valueOf(script) ).tojstring());

i used this my lua file is in assets i just put print("hello") in my lua file so i should get hello as result in my text view but i always get "nil" in my textview is there any solutions?

1 Answers1

2

print("hello") prints "hello" and then returns nil. The value you get from chunk.call is what your Lua code returned, not what it printed.

  • So how can i get the excute result in these way i really tried alot i dont got it would be helpfull if you can help me with that – Muhamad Gamer Sep 16 '19 at 21:36