org.luaj.vm
Class LFunction

java.lang.Object
  extended by org.luaj.vm.LValue
      extended by org.luaj.vm.LFunction
Direct Known Subclasses:
LClosure, LuajavaLib

public abstract class LFunction
extends LValue


Field Summary
 
Fields inherited from class org.luaj.vm.LValue
TM_INDEX, TM_METATABLE, TM_MODE, TM_NEWINDEX
 
Constructor Summary
LFunction()
           
 
Method Summary
 LValue __index(LuaState vm, LValue table, LValue key)
          Process lua tag method __index when it points to a function.
 void __newindex(LuaState vm, LValue table, LValue key, LValue val)
          Process lua tag method __newindex when it points to a function Default method calls the function using the vm.
 int invoke(LuaState lua)
          Called to invoke a JavaFunction.
 boolean isFunction()
          Return true if this is a LFunction
 int luaGetType()
          Valid for all types: return the int value identifying the type of this value
 boolean luaStackCall(LuaState vm)
          Set up a Java invocation, and leave the results on the stack starting at base.
 java.lang.String toJavaString()
          Convert to a Java String
 
Methods inherited from class org.luaj.vm.LValue
compareError, conversionError, id, isClosure, isInteger, isNil, isNumber, isString, isTable, isUserData, luaAsString, luaBinCmpDouble, luaBinCmpInteger, luaBinCmpString, luaBinCmpUnknown, luaBinOpDouble, luaBinOpInteger, luaBinOpUnknown, luaConcatTo, luaGetEnv, luaGetMetatable, luaGetTable, luaGetTypeName, luaLength, luaSetEnv, luaSetMetatable, luaSetTable, luaToNumber, luaUnaryMinus, toJavaBoolean, toJavaBoxedBoolean, toJavaBoxedByte, toJavaBoxedCharacter, toJavaBoxedDouble, toJavaBoxedFloat, toJavaBoxedInteger, toJavaBoxedLong, toJavaBoxedShort, toJavaByte, toJavaChar, toJavaDouble, toJavaFloat, toJavaInstance, toJavaInt, toJavaLong, toJavaShort, toString, toStrongReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LFunction

public LFunction()
Method Detail

toJavaString

public java.lang.String toJavaString()
Description copied from class: LValue
Convert to a Java String

Overrides:
toJavaString in class LValue

isFunction

public boolean isFunction()
Description copied from class: LValue
Return true if this is a LFunction

Overrides:
isFunction in class LValue

luaGetType

public int luaGetType()
Description copied from class: LValue
Valid for all types: return the int value identifying the type of this value

Specified by:
luaGetType in class LValue

luaStackCall

public boolean luaStackCall(LuaState vm)
Set up a Java invocation, and leave the results on the stack starting at base. The default implementation for LFunction delegates to the VM which provides convenience.

Overrides:
luaStackCall in class LValue

invoke

public int invoke(LuaState lua)
Called to invoke a JavaFunction. The implementation should manipulate the stack via the VM Java API in the same way that lua_CFunctions do so in standard lua. Arguments to the function will be in position 1-n. Return values can be pushed onto the stack, and will be copied down to the appropriate location by the calling LuaState.

Parameters:
lua - the LuaState calling this function.
Returns:
number of results pushed onto the stack.

__index

public LValue __index(LuaState vm,
                      LValue table,
                      LValue key)
Process lua tag method __index when it points to a function. Default method calls the function using the vm.

Parameters:
vm -
table -
key -
Returns:

__newindex

public void __newindex(LuaState vm,
                       LValue table,
                       LValue key,
                       LValue val)
Process lua tag method __newindex when it points to a function Default method calls the function using the vm.

Parameters:
vm -
table -
key -
val -


Copyright © 2007-2013 Luaj.org. All Rights Reserved.