- Found in:
- JContainers
floatfunctionevalLuaFlt(stringluaCode, inttransport, floatdefault=0.0, boolminimizeLifetime=true)NativeGlobal
Description
Documentation Comment
Evaluates piece of Lua code. The arguments are carried by @transport object.
The @transport is any kind of object, not just JMap.
If @minimizeLifetime is True the function will invoke JValue.zeroLifetime on the @transport object.
It is more than wise to re-use @transport when evaluating lot of lua code at once.
Returns @default value if evaluation fails.
WARNING: You can transfer in/out from Lua only 24-bit integers with exact precision (+/- 16 777 216)
Anything bigger or smaller than that will have "holes" due to how the floating point rounding works.
Usage example:
; 7 from the end until 9 from the end. Returns "Lua" string
string input = "Hello Lua user"
string s = JLua.evaLuaStr("return string.sub(args.string, args.low, args.high)",\
JLua.setStr("string",input, JLua.setInt("low",7, JLua.setInt("high",9 )))\
)
Parameters
stringluaCode
inttransport
floatdefault=0.0
boolminimizeLifetime=true
Examples
Auto-Generated Example
string myString__luaCode
int myInt__transport
float myFloat__default
bool myBool__minimizeLifetime
float returnedValue = JLua.evalLuaFlt(myString__luaCode, myInt__transport, myFloat__default, myBool__minimizeLifetime)