|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.luaj.vm2.Varargs org.luaj.vm2.LuaValue org.luaj.vm2.LuaFunction org.luaj.vm2.lib.LibFunction org.luaj.vm2.lib.OneArgFunction org.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 BaseLib.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()
To instantiate and use it directly,
link it into your globals table via LuaValue.load(LuaValue)
using code such as:
LuaTable _G = new LuaTable();
LuaThread.setGlobals(_G);
_G.load(new JseBaseLib());
_G.get("print").call(LuaValue.valueOf("hello, world"));
Doing so will ensure the library is properly initialized
and loaded into the globals table.
This is a direct port of the corresponding library in C.
BaseLib
,
ResourceFinder
,
BaseLib.FINDER
,
LibFunction
,
JsePlatform
,
JmePlatform
,
http://www.lua.org/manual/5.1/manual.html#5.1Field Summary |
---|
Fields inherited from class org.luaj.vm2.lib.BaseLib |
---|
FINDER, instance, STDERR, STDIN, STDOUT |
Fields inherited from class org.luaj.vm2.lib.LibFunction |
---|
name, opcode |
Fields inherited from class org.luaj.vm2.LuaFunction |
---|
env, s_metatable |
Fields inherited from class org.luaj.vm2.LuaValue |
---|
ADD, CALL, CONCAT, DIV, EMPTYSTRING, EQ, FALSE, INDEX, LE, LEN, LT, METATABLE, MINUSONE, MOD, MODE, MUL, NEWINDEX, NIL, NILS, NONE, NOVALS, ONE, POW, SUB, TBOOLEAN, TFUNCTION, TINT, TLIGHTUSERDATA, TNIL, TNONE, TNUMBER, TOSTRING, TRUE, TSTRING, TTABLE, TTHREAD, TUSERDATA, TVALUE, TYPE_NAMES, UNM, ZERO |
Constructor Summary | |
---|---|
JseBaseLib()
Construct a JSE base library instance |
Method Summary | |
---|---|
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 org.luaj.vm2.lib.BaseLib |
---|
call, loadFile, loadStream, pcall |
Methods inherited from class org.luaj.vm2.lib.OneArgFunction |
---|
call, call, call, invoke |
Methods inherited from class org.luaj.vm2.lib.LibFunction |
---|
bind, bind, newupe, newupl, newupn, tojstring |
Methods inherited from class org.luaj.vm2.LuaFunction |
---|
checkfunction, getfenv, getmetatable, isfunction, optfunction, setfenv, type, typename |
Methods inherited from class org.luaj.vm2.Varargs |
---|
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkinteger, checkjstring, checklong, checknotnil, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, checkvalue, eval, isfunction, isnil, isnoneornil, isnumber, isstring, istable, isTailcall, isthread, isuserdata, isvalue, optboolean, optclosure, optdouble, optfunction, optint, optinteger, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, subargs, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tolong, toshort, touserdata, touserdata, type |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JseBaseLib()
Method Detail |
---|
public java.io.InputStream findResource(java.lang.String filename)
findResource
in interface ResourceFinder
findResource
in class BaseLib
filename
-
BaseLib
,
ResourceFinder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |