org.luaj.vm2.LuaNumber Java Examples
The following examples show how to use
org.luaj.vm2.LuaNumber.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch (value.type()) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable(mt); } return value; }
Example #2
Source File: LuaInterpreter.java From claudb with MIT License | 6 votes |
private RedisToken convert(Object result) { return Pattern1.<Object, RedisToken>build() .when(instanceOf(LuaTable.class)) .then(table -> convertLuaTable((LuaTable) table)) .when(instanceOf(LuaNumber.class)) .then(number -> convertLuaNumber((LuaNumber) number)) .when(instanceOf(LuaBoolean.class)) .then(boolean_ -> convertLuaBoolean((LuaBoolean) boolean_)) .when(instanceOf(LuaString.class)) .then(string -> convertLuaString((LuaString) string)) .when(instanceOf(Number.class)) .then(number -> convertNumber((Number) number)) .when(instanceOf(String.class)) .then(string -> convertString((String) string)) .when(instanceOf(Boolean.class)) .then(boolean_ -> convertBoolean((Boolean) boolean_)) .otherwise() .then(this::convertUnknown) .apply(result); }
Example #3
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; }
Example #4
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; }
Example #5
Source File: DebugLib.java From luaj with MIT License | 5 votes |
public LuaValue call(LuaValue value, LuaValue table) { LuaValue mt = table.opttable(null); switch ( value.type() ) { case TNIL: LuaNil.s_metatable = mt; break; case TNUMBER: LuaNumber.s_metatable = mt; break; case TBOOLEAN: LuaBoolean.s_metatable = mt; break; case TSTRING: LuaString.s_metatable = mt; break; case TFUNCTION: LuaFunction.s_metatable = mt; break; case TTHREAD: LuaThread.s_metatable = mt; break; default: value.setmetatable( mt ); } return value; }
Example #6
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public static Long getLong(Varargs varargs, Long defaultValue, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, defaultValue, poslist); return number != null ? number.checklong() : null; }
Example #7
Source File: LuaInterpreter.java From claudb with MIT License | 4 votes |
private RedisToken convertLuaNumber(LuaNumber value) { return integer(value.toint()); }
Example #8
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取int * * @param varargs * @param poslist * @return */ public static Integer getInt(Varargs varargs, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, poslist); return number != null ? number.checkint() : null; }
Example #9
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取long * * @param varargs * @param poslist * @return */ public static Long getLong(Varargs varargs, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, poslist); return number != null ? number.checklong() : null; }
Example #10
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取double * * @param varargs * @param poslist * @return */ public static Double getDouble(Varargs varargs, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, poslist); return number != null ? number.checkdouble() : null; }
Example #11
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取double * * @param varargs * @param poslist * @return */ public static Double getDouble(Varargs varargs, Double defaultValue, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, poslist); return number != null ? number.checkdouble() : defaultValue; }
Example #12
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取float * * @param varargs * @param poslist * @return */ public static Float getFloat(Varargs varargs, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, poslist); return number != null ? (float) number.checkdouble() : null; }
Example #13
Source File: LuaUtil.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取float * * @param varargs * @param poslist * @return */ public static Float getFloat(Varargs varargs, Float defaultValue, int... poslist) { LuaNumber number = (LuaNumber) getValue(LuaValue.TNUMBER, varargs, defaultValue, poslist); return number != null ? (float) number.checkdouble() : defaultValue; }