org.keplerproject.luajava
Class LuaStateFactory

java.lang.Object
  extended by org.keplerproject.luajava.LuaStateFactory

public final class LuaStateFactory
extends java.lang.Object

This class is responsible for instantiating new LuaStates. When a new LuaState is instantiated it is put into a List and an index is returned. This index is registred in Lua and it is used to find the right LuaState when lua calls a Java Function.


Method Summary
static LuaState getExistingState(int index)
          Returns a existing instance of LuaState
static int insertLuaState(LuaState L)
          Receives a existing LuaState and checks if it exists in the states list.
static LuaState newLuaState()
          Method that creates a new instance of LuaState
static void removeLuaState(int idx)
          removes the luaState from the states list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newLuaState

public static LuaState newLuaState()
Method that creates a new instance of LuaState

Returns:
LuaState

getExistingState

public static LuaState getExistingState(int index)
Returns a existing instance of LuaState

Parameters:
index -
Returns:
LuaState

insertLuaState

public static int insertLuaState(LuaState L)
Receives a existing LuaState and checks if it exists in the states list. If it doesn't exist adds it to the list.

Parameters:
L -
Returns:
int

removeLuaState

public static void removeLuaState(int idx)
removes the luaState from the states list

Parameters:
idx -