Question

Im trying to load the json module in Java code. The example in the Doc shows that it should go like this but it doesnt work. Does it require the module to be in the project or it loads it from LUA_PATH. does anyone have any experience with this issue?

Globals globals = JsePlatform.standardGlobals();
globals.get("require").call( LuaValue.valueOf("json") );

Exception in thread "main" org.luaj.vm2.LuaError: module 'json' not found: json no field package.preload['json'] json.lua no class 'json'

It looks like it is trying just within the LuaJ package.

No correct solution

OTHER TIPS

If the json module you are using is written in lua, then it'll need to be in the package.path like any other lua module.

If it's written in java then LuaJ will need to be able to find json.class in the normal Java classpath.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top