|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.luaj.vm.Platform
public abstract class Platform
Singleton to manage platform-specific behaviors.
Here is the sample code to set up the platform instance and create a new LuaState instance.
Platform.setInstance(new J2meMidp20Cldc11Platform());
LuaState vm = Platform.newLuaState();
| Field Summary | |
|---|---|
static java.lang.String |
LUA_STATE_CLASS_NAME
When non-null, name of a Java Class that implements LuaState and has a default constructor which will be used to construct a new lua state using Platform.newLuaState() |
| Constructor Summary | |
|---|---|
Platform()
|
|
| Method Summary | |
|---|---|
abstract java.io.Reader |
createReader(java.io.InputStream inputStream)
Create Reader from an InputStream |
static Platform |
getInstance()
Singleton to be used for platform operations. |
abstract java.lang.String |
getName()
Get the name of the platform |
abstract java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value for the given platform property. |
protected abstract void |
installOptionalLibs(LuaState vm)
Install optional libraries on the LuaState. |
abstract LNumber |
mathop(int id,
LNumber x)
Compute a math operation that takes a single double argument and returns a double |
abstract LNumber |
mathop(int id,
LNumber x,
LNumber y)
Compute a math operation that takes a two double arguments and returns a double |
abstract LNumber |
mathPow(LNumber base,
LNumber exponent)
Compute math.pow() for two numbers using double math when available. |
static LuaState |
newLuaState()
Creates a new instance of LuaState. |
abstract java.io.InputStream |
openFile(java.lang.String fileName)
Return an InputStream or null if not found for a particular file name. |
static void |
setInstance(Platform platform)
Set the Platform instance. |
LNumber |
unsupportedMathOp()
Throw an error indicating the math operation is not accepted |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String LUA_STATE_CLASS_NAME
newLuaState| Constructor Detail |
|---|
public Platform()
| Method Detail |
|---|
public static Platform getInstance()
public static void setInstance(Platform platform)
public static LuaState newLuaState()
LUA_STATE_CLASS_NAME,
LuaStatepublic abstract java.lang.String getName()
public abstract java.io.InputStream openFile(java.lang.String fileName)
fileName - Name of the file to open
public abstract java.io.Reader createReader(java.io.InputStream inputStream)
inputStream - InputStream to read from
public abstract java.lang.String getProperty(java.lang.String propertyName)
propertyName - Property name
protected abstract void installOptionalLibs(LuaState vm)
vm - LuaState instance
public abstract LNumber mathPow(LNumber base,
LNumber exponent)
lhs - LNumber baserhs - LNumber exponent
public abstract LNumber mathop(int id,
LNumber x)
id - the math op, from MathLib constantsx - the argument
LuaErrorException - if the id is not supported by this platform.
public abstract LNumber mathop(int id,
LNumber x,
LNumber y)
id - the math op, from MathLib constantsx - the first argument as an LNumbery - the second arugment as an LNumber
LuaErrorException - if the id is not supported by this platform.public LNumber unsupportedMathOp()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||