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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.