|
||||||||||
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.VarArgFunction org.luaj.vm2.lib.OsLib org.luaj.vm2.lib.jse.JseOsLib
public class JseOsLib
Subclass of LibFunction
which implements the standard lua os
library.
This contains more complete implementations of the following functions using features that are specific to JSE:
execute()
remove()
rename()
tmpname()
Because the nature of the os
library is to encapsulate
os-specific features, the behavior of these functions varies considerably
from their counterparts in the C platform.
Typically, this library is included as part of a call to either
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.load(new PackageLib());
_G.load(new JseOsLib());
System.out.println( _G.get("os").get("time").call() );
Doing so will ensure the library is properly initialized
and loaded into the globals table.
LibFunction
,
OsLib
,
JsePlatform
,
JmePlatform
,
http://www.lua.org/manual/5.1/manual.html#5.8Field Summary | |
---|---|
static int |
EXEC_ERROR
return code indicating the execute() threw an unknown exception |
static int |
EXEC_INTERRUPTED
return code indicating the execute() was interrupted |
static int |
EXEC_IOEXCEPTION
return code indicating the execute() threw an I/O exception |
Fields inherited from class org.luaj.vm2.lib.OsLib |
---|
TMP_PREFIX, TMP_SUFFIX |
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 | |
---|---|
JseOsLib()
public constructor |
Method Summary | |
---|---|
protected int |
execute(java.lang.String command)
This function is equivalent to the C function system. |
protected void |
remove(java.lang.String filename)
Deletes the file or directory with the given name. |
protected void |
rename(java.lang.String oldname,
java.lang.String newname)
Renames file or directory named oldname to newname. |
protected java.lang.String |
tmpname()
Returns a string with a file name that can be used for a temporary file. |
Methods inherited from class org.luaj.vm2.lib.OsLib |
---|
clock, date, difftime, exit, getenv, init, invoke, setlocale, time |
Methods inherited from class org.luaj.vm2.lib.VarArgFunction |
---|
call, call, call, call, onInvoke |
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 |
Field Detail |
---|
public static int EXEC_IOEXCEPTION
public static int EXEC_INTERRUPTED
public static int EXEC_ERROR
Constructor Detail |
---|
public JseOsLib()
Method Detail |
---|
protected int execute(java.lang.String command)
OsLib
execute
in class OsLib
command
- command to pass to the systemprotected void remove(java.lang.String filename) throws java.io.IOException
OsLib
remove
in class OsLib
java.io.IOException
- if it failsprotected void rename(java.lang.String oldname, java.lang.String newname) throws java.io.IOException
OsLib
rename
in class OsLib
oldname
- old file namenewname
- new file name
java.io.IOException
- if it failsprotected java.lang.String tmpname()
OsLib
tmpname
in class OsLib
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |