I just started using luaj in my project and I want to get the string content inside my lua table. For example:
t = {
subTitle = "Haircut",
}
return t;
I want get the content of subtitle which should be very simple but I have no idea how to do it. In my code, I wrote code like following example:
public class MainActivity extends ActionBarActivity {
Globals globals = JsePlatform.standardGlobals();
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView)findViewById(R.id.text);
try {
LuaValue chunk = globals.loadfile("assets/Test.lua");
String text = chunk.get("t").get("subTitle").call().tojstring();
textView.append(text);
}
catch (Exception e)
{
}
}
}
But it kept telling me get() can only be applied to get function. How can I get the content of subTitle? Thank you so much for helping.