|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.luaj.vm2.lib.BaseLib
org.luaj.vm2.lib.jse.JseBaseLib
public class JseBaseLib
Subclass of BaseLib and LibFunction which implements the lua basic library functions
and provides a directory based ResourceFinder as the #finder.
Since JME has no file system by default, BaseLib implements
ResourceFinder using Class.getResource(String).
The JseBaseLib implements finder by scanning the current directory
first, then falling back to Class.getResource(String) if that fails.
Otherwise, the behavior is the same as that of BaseLib.
Typically, this library is included as part of a call to
JsePlatform.standardGlobals()
Globals globals = JsePlatform.standardGlobals();
globals.get("print").call(LuaValue.valueOf("hello, world"));
For special cases where the smallest possible footprint is desired,
a minimal set of libraries could be loaded
directly via Globals#load(LuaValue) using code such as:
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.get("print").call(LuaValue.valueOf("hello, world"));
However, other libraries such as PackageLib are not loaded in this case.
This is a direct port of the corresponding library in C.
Globals,
BaseLib,
ResourceFinder,
Globals.finder},
LibFunction,
JsePlatform,
org.luaj.vm2.lib.jme.JmePlatform,
Lua 5.2 Base Lib Reference| Constructor Summary | |
|---|---|
JseBaseLib()
|
|
| Method Summary | |
|---|---|
LuaValue |
call(LuaValue modname,
LuaValue env)
Extend the library loading to set the default value for Globals.STDIN |
java.io.InputStream |
findResource(java.lang.String filename)
Try to open a file in the current working directory, or fall back to base opener if not found. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JseBaseLib()
| Method Detail |
|---|
public LuaValue call(LuaValue modname,
LuaValue env)
Globals.STDIN
public java.io.InputStream findResource(java.lang.String filename)
filename -
org.luaj.vm2.lib.BaseLib,
org.luaj.vm2.lib.ResourceFinder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||