today I tried the LuaJ library and I really enjoy it, the only problem i have with it, is that I can't load from a String containing the functions, instead I can only load of a string containing the filepath.
Here is the code that I tried to load from a String:
LuaValue globals = JsePlatform.standardGlobals();
globals.get("load").call( LuaValue.valueOf(luascript)); //Exception in this line
With this code I get the following exception:
Exception in thread "LWJGL Application" org.luaj.vm2.LuaError: attempt to call nil
at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)
at org.luaj.vm2.LuaValue.callmt(Unknown Source)
at org.luaj.vm2.LuaValue.call(Unknown Source)
at Screens.MainMenu.<init>(MainMenu.java:122)
The code that works, but that I don't want, because I need to load it from a string, instead of a filepath is this:
LuaValue globals = JsePlatform.standardGlobals();
globals.get("dofile").call( LuaValue.valueOf(pathtoluascript) );
So my question is, how do i load it from a string instead of a path?