|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.luaj.vm2.Varargs
org.luaj.vm2.LuaValue
org.luaj.vm2.LuaFunction
public abstract class LuaFunction
Base class for functions implemented in Java.
Direct subclass include LibFunction
which is the base class for
all built-in library functions coded in Java,
and LuaClosure, which represents a lua closure
whose bytecode is interpreted when the function is invoked.
LuaValue,
LuaClosure,
LibFunction| Field Summary | |
|---|---|
static LuaValue |
s_metatable
Shared static metatable for all functions and closures. |
| Fields inherited from class org.luaj.vm2.LuaValue |
|---|
ADD, CALL, CONCAT, DIV, EMPTYSTRING, ENV, 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 | |
|---|---|
LuaFunction()
|
|
| Method Summary | |
|---|---|
LuaFunction |
checkfunction()
Check that the value is a function , or throw LuaError if not |
java.lang.String |
classnamestub()
Return the last part of the class name, to be used as a function name in tojstring and elsewhere. |
LuaValue |
getmetatable()
Get the metatable for this LuaValue |
boolean |
isfunction()
Check if this is a function |
java.lang.String |
name()
Return a human-readable name for this function. |
LuaFunction |
optfunction(LuaFunction defval)
Check that optional argument is a function and return as LuaFunction |
LuaString |
strvalue()
Convert this value to a string if it is a LuaString or LuaNumber,
or throw a LuaError if it is not |
java.lang.String |
tojstring()
Convert to human readable String for any type. |
int |
type()
Get the enumeration value for the type of this value. |
java.lang.String |
typename()
Get the String name of the type of this value. |
| 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, 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 LuaValue s_metatable
| Constructor Detail |
|---|
public LuaFunction()
| Method Detail |
|---|
public int type()
LuaValue
type in class LuaValueLuaValue.TNIL,
LuaValue.TBOOLEAN,
LuaValue.TNUMBER,
LuaValue.TSTRING,
LuaValue.TTABLE,
LuaValue.TFUNCTION,
LuaValue.TUSERDATA,
LuaValue.TTHREADLuaValue.typename()public java.lang.String typename()
LuaValue
typename in class LuaValueLuaValue.TYPE_NAMES
corresponding to the type of this value:
"nil", "boolean", "number", "string",
"table", "function", "userdata", "thread"LuaValue.type()public boolean isfunction()
LuaValuethis is a function
isfunction in class LuaValuefunction, otherwise falseLuaValue.isclosure(),
LuaValue.checkfunction(),
LuaValue.optfunction(LuaFunction),
LuaValue.TFUNCTIONpublic LuaFunction checkfunction()
LuaValueLuaError if not
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode.
checkfunction in class LuaValuethis if it is a lua function or closureLuaValue.checkclosure()public LuaFunction optfunction(LuaFunction defval)
LuaValueLuaFunction
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode.
optfunction in class LuaValuedefval - LuaFunction to return if this is nil or none
this cast to LuaFunction if a function,
defval if nil or none,
throws LuaError otherwiseLuaValue.checkfunction(),
LuaValue.isfunction(),
LuaValue.TFUNCTIONpublic LuaValue getmetatable()
LuaValueLuaValue
For LuaTable and LuaUserdata instances,
the metatable returned is this instance metatable.
For all other types, the class metatable value will be returned.
getmetatable in class LuaValueLuaBoolean.s_metatable,
LuaNumber.s_metatable,
LuaNil.s_metatable,
s_metatable,
LuaThread.s_metatablepublic java.lang.String tojstring()
LuaValue
tojstring in class LuaValueLuaValue.tostring(),
LuaValue.optjstring(String),
LuaValue.checkjstring(),
LuaValue.isstring(),
LuaValue.TSTRINGpublic LuaString strvalue()
LuaValueLuaString or LuaNumber,
or throw a LuaError if it is not
strvalue in class LuaValueLuaString corresponding to the value if a string or numberpublic java.lang.String classnamestub()
public java.lang.String name()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||