|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.luaj.vm2.lib.MathLib
org.luaj.vm2.lib.jse.JseMathLib
public class JseMathLib
Subclass of LibFunction which implements the lua standard math
library.
It contains all lua math functions, including those not available on the JME platform.
See org.luaj.lib.MathLib for the exception list.
Typically, this library is included as part of a call to
JsePlatform.standardGlobals()
Globals globals = JsePlatform.standardGlobals();
System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
For special cases where the smallest possible footprint is desired,
a minimal set of libraries could be loaded
directly via Globals#load(LuaValue) using code such as:
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new JseMathLib());
System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
However, other libraries such as CoroutineLib are not loaded in this case.
This has been implemented to match as closely as possible the behavior in the corresponding library in C.
LibFunction,
JsePlatform,
org.luaj.vm2.lib.jme.JmePlatform,
JseMathLib,
Lua 5.2 Math Lib Reference| Constructor Summary | |
|---|---|
JseMathLib()
|
|
| Method Summary | |
|---|---|
LuaValue |
call(LuaValue modname,
LuaValue env)
|
double |
dpow_lib(double a,
double b)
Faster, better version of pow() used by arithmetic operator ^ |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JseMathLib()
| Method Detail |
|---|
public LuaValue call(LuaValue modname,
LuaValue env)
public double dpow_lib(double a,
double b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||