|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.luaj.vm2.lib.jme.JmePlatform
public class JmePlatform
The JmePlatform class is a convenience class to standardize
how globals tables are initialized for the JME platform.
The JME platform, being limited, cannot implement all libraries in all aspects. The main limitations are
MathLib for detailsBaseLib for detailsOsLib for detailsJmeIoLib for detailsLuajavaLib for details
It is used to allocate either a set of standard globals using
standardGlobals() or debug globals using debugGlobals()
A simple example of initializing globals and using them from Java is:
LuaValue _G = JmePlatform.standardGlobals();
_G.get("print").call(LuaValue.valueOf("hello, world"));
Once globals are created, a simple way to load and run a script is:
LoadState.load( getClass().getResourceAsStream("main.lua"), "main.lua", _G ).call();
although require could also be used:
_G.get("require").call(LuaValue.valueOf("main"));
For this to succeed, the file "main.lua" must be a resource in the class path.
See BaseLib for details on finding scripts using ResourceFinder.
The standard globals will contain all standard libraries in their JME flavors:
In addition, theLuaC compiler is installed so lua files may be loaded in their source form.
The debug globals are simply the standard globals plus the debug library DebugLib.
The class ensures that initialization is done in the correct order,
and that linkage is made to LuaThread.setGlobals(LuaValue).
JsePlatform,
LoadState| Constructor Summary | |
|---|---|
JmePlatform()
|
|
| Method Summary | |
|---|---|
static LuaTable |
debugGlobals()
Create standard globals including the debug library. |
static LuaTable |
standardGlobals()
Create a standard set of globals for JME including all the libraries. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JmePlatform()
| Method Detail |
|---|
public static LuaTable standardGlobals()
debugGlobals(),
JsePlatform,
JmePlatformpublic static LuaTable debugGlobals()
debug library.
#standarsGlobals(),
JsePlatform,
JmePlatform,
DebugLib
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||