Java Code Examples for org.luaj.vm2.LuaValue#length()
The following examples show how to use
org.luaj.vm2.LuaValue#length() .
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: CoerceLuaToJava.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
public Object coerce(LuaValue value) { switch (value.type()) { case LuaValue.TTABLE: { int n = value.length(); Object a = Array.newInstance(componentType, n); for (int i = 0; i < n; i++) Array.set(a, i, componentCoercion.coerce(value.get(i + 1))); return a; } case LuaValue.TUSERDATA: return value.touserdata(); case LuaValue.TNIL: return null; default: return null; } }
Example 2
Source File: CoerceLuaToJava.java From XPrivacyLua with GNU General Public License v3.0 | 6 votes |
public Object coerce(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: { int n = value.length(); Object a = Array.newInstance(componentType, n); for ( int i=0; i<n; i++ ) Array.set(a, i, componentCoercion.coerce(value.get(i+1))); return a; } case LuaValue.TUSERDATA: return value.touserdata(); case LuaValue.TNIL: return null; default: return null; } }
Example 3
Source File: CoerceLuaToJava.java From HtmlNative with Apache License 2.0 | 6 votes |
public Object coerce(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: { int n = value.length(); Object a = Array.newInstance(componentType, n); for ( int i=0; i<n; i++ ) Array.set(a, i, componentCoercion.coerce(value.get(i+1))); return a; } case LuaValue.TUSERDATA: return value.touserdata(); case LuaValue.TNIL: return null; default: return null; } }
Example 4
Source File: CoerceLuaToJava.java From luaj with MIT License | 6 votes |
public Object coerce(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: { int n = value.length(); Object a = Array.newInstance(componentType, n); for ( int i=0; i<n; i++ ) Array.set(a, i, componentCoercion.coerce(value.get(i+1))); return a; } case LuaValue.TUSERDATA: return value.touserdata(); case LuaValue.TNIL: return null; default: return null; } }
Example 5
Source File: CoerceLuaToJava.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public int score(LuaValue value) { switch (value.type()) { case LuaValue.TTABLE: return value.length() == 0 ? 0 : componentCoercion.score(value.get(1)); case LuaValue.TUSERDATA: return inheritanceLevels(componentType, value.touserdata().getClass().getComponentType()); case LuaValue.TNIL: return SCORE_NULL_VALUE; default: return SCORE_UNCOERCIBLE; } }
Example 6
Source File: CoerceLuaToJava.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public int score(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: return value.length()==0? 0: componentCoercion.score( value.get(1) ); case LuaValue.TUSERDATA: return inheritanceLevels( componentType, value.touserdata().getClass().getComponentType() ); case LuaValue.TNIL: return SCORE_NULL_VALUE; default: return SCORE_UNCOERCIBLE; } }
Example 7
Source File: CoerceLuaToJava.java From HtmlNative with Apache License 2.0 | 5 votes |
public int score(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: return value.length()==0? 0: componentCoercion.score( value.get(1) ); case LuaValue.TUSERDATA: return inheritanceLevels( componentType, value.touserdata().getClass().getComponentType() ); case LuaValue.TNIL: return SCORE_NULL_VALUE; default: return SCORE_UNCOERCIBLE; } }
Example 8
Source File: CoerceLuaToJava.java From luaj with MIT License | 5 votes |
public int score(LuaValue value) { switch ( value.type() ) { case LuaValue.TTABLE: return value.length()==0? 0: componentCoercion.score( value.get(1) ); case LuaValue.TUSERDATA: return inheritanceLevels( componentType, value.touserdata().getClass().getComponentType() ); case LuaValue.TNIL: return SCORE_NULL_VALUE; default: return SCORE_UNCOERCIBLE; } }