se.krka.kahlua.stdlib
Class BaseLib
java.lang.Object
se.krka.kahlua.stdlib.BaseLib
- All Implemented Interfaces:
- JavaFunction
public final class BaseLib
- extends java.lang.Object
- implements JavaFunction
Constructor Summary |
BaseLib(int index)
|
Method Summary |
int |
call(LuaCallFrame callFrame,
int nArguments)
General contract
Input:
callFrame = the frame that contains all the arguments, and where all the results should be put.
nArgs = number of function arguments
callFrame.get(i) = an argument (0 <= i < nArgs)
|
static int |
collectgarbage(LuaCallFrame callFrame,
int nArguments)
|
static java.lang.Object |
getArg(LuaCallFrame callFrame,
int n,
java.lang.String type,
java.lang.String function)
|
static java.lang.Object |
getOptArg(LuaCallFrame callFrame,
int n,
java.lang.String type)
|
static void |
luaAssert(boolean b,
java.lang.String msg)
|
static java.lang.String |
numberToString(java.lang.Double num)
|
static int |
pcall(LuaCallFrame callFrame,
int nArguments)
|
static java.lang.Double |
rawTonumber(java.lang.Object o)
|
static java.lang.String |
rawTostring(java.lang.Object o)
|
static void |
register(LuaState state)
|
static void |
setmetatable(LuaState state,
java.lang.Object o,
LuaTable newMeta,
boolean raw)
|
static java.lang.Double |
tonumber(java.lang.String s)
|
static java.lang.Double |
tonumber(java.lang.String s,
int radix)
|
java.lang.String |
toString()
|
static java.lang.String |
tostring(java.lang.Object o,
LuaState state)
|
static java.lang.String |
type(java.lang.Object o)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TYPE_NIL
public static final java.lang.String TYPE_NIL
- See Also:
- Constant Field Values
TYPE_STRING
public static final java.lang.String TYPE_STRING
- See Also:
- Constant Field Values
TYPE_NUMBER
public static final java.lang.String TYPE_NUMBER
- See Also:
- Constant Field Values
TYPE_BOOLEAN
public static final java.lang.String TYPE_BOOLEAN
- See Also:
- Constant Field Values
TYPE_FUNCTION
public static final java.lang.String TYPE_FUNCTION
- See Also:
- Constant Field Values
TYPE_TABLE
public static final java.lang.String TYPE_TABLE
- See Also:
- Constant Field Values
TYPE_THREAD
public static final java.lang.String TYPE_THREAD
- See Also:
- Constant Field Values
TYPE_USERDATA
public static final java.lang.String TYPE_USERDATA
- See Also:
- Constant Field Values
BaseLib
public BaseLib(int index)
register
public static void register(LuaState state)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
call
public int call(LuaCallFrame callFrame,
int nArguments)
- Description copied from interface:
JavaFunction
- General contract
Input:
callFrame = the frame that contains all the arguments, and where all the results should be put.
nArgs = number of function arguments
callFrame.get(i) = an argument (0 <= i < nArgs)
- Specified by:
call
in interface JavaFunction
- Parameters:
callFrame
- - the current callframe for the functionnArguments
- - number of function arguments
- Returns:
- N - number of return values. The N top objects on the stack are considered the return values
pcall
public static int pcall(LuaCallFrame callFrame,
int nArguments)
luaAssert
public static void luaAssert(boolean b,
java.lang.String msg)
numberToString
public static java.lang.String numberToString(java.lang.Double num)
getArg
public static java.lang.Object getArg(LuaCallFrame callFrame,
int n,
java.lang.String type,
java.lang.String function)
- Parameters:
callFrame
- n
- type
- must be "string" or "number" or one of the other built in types. Note that this parameter must be interned!
It's not valid to call it with new String("number"). Use null if you don't care which type or expect
more than one type for this argument.function
- name of the function that calls this. Only for pretty exceptions.
- Returns:
- variable with index n on the stack, returned as type "type".
getOptArg
public static java.lang.Object getOptArg(LuaCallFrame callFrame,
int n,
java.lang.String type)
setmetatable
public static void setmetatable(LuaState state,
java.lang.Object o,
LuaTable newMeta,
boolean raw)
type
public static java.lang.String type(java.lang.Object o)
tostring
public static java.lang.String tostring(java.lang.Object o,
LuaState state)
tonumber
public static java.lang.Double tonumber(java.lang.String s)
tonumber
public static java.lang.Double tonumber(java.lang.String s,
int radix)
collectgarbage
public static int collectgarbage(LuaCallFrame callFrame,
int nArguments)
rawTostring
public static java.lang.String rawTostring(java.lang.Object o)
rawTonumber
public static java.lang.Double rawTonumber(java.lang.Object o)