本文整理了Java中org.luaj.vm2.LuaTable.next()
方法的一些代码示例,展示了LuaTable.next()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LuaTable.next()
方法的具体详情如下:
包路径:org.luaj.vm2.LuaTable
类名称:LuaTable
方法名:next
[英]Get the next element after a particular key in the table
[中]获取表中特定键后的下一个元素
代码示例来源:origin: hsllany/HtmlNative
/** This may be deprecated in a future release.
* It is recommended to use next() instead
* @return array of keys in the table
* */
public LuaValue[] keys() {
Vector l = new Vector();
LuaValue k = LuaValue.NIL;
while ( true ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
break;
l.addElement( k );
}
LuaValue[] a = new LuaValue[l.size()];
l.copyInto(a);
return a;
}
代码示例来源:origin: mirkosertic/GameComposer
/** This may be deprecated in a future release.
* It is recommended to use next() instead
* @return array of keys in the table
* */
public LuaValue[] keys() {
Vector l = new Vector();
LuaValue k = LuaValue.NIL;
while ( true ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
break;
l.addElement( k );
}
LuaValue[] a = new LuaValue[l.size()];
l.copyInto(a);
return a;
}
代码示例来源:origin: M66B/XPrivacyLua
/** This may be deprecated in a future release.
* It is recommended to use next() instead
* @return array of keys in the table
* */
public LuaValue[] keys() {
Vector l = new Vector();
LuaValue k = LuaValue.NIL;
while ( true ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
break;
l.addElement( k );
}
LuaValue[] a = new LuaValue[l.size()];
l.copyInto(a);
return a;
}
代码示例来源:origin: M66B/XPrivacyLua
/** This may be deprecated in a future release.
* It is recommended to count via iteration over next() instead
* @return count of keys in the table
* */
public int keyCount() {
LuaValue k = LuaValue.NIL;
for ( int i=0; true; i++ ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
return i;
}
}
代码示例来源:origin: hsllany/HtmlNative
/** This may be deprecated in a future release.
* It is recommended to count via iteration over next() instead
* @return count of keys in the table
* */
public int keyCount() {
LuaValue k = LuaValue.NIL;
for ( int i=0; true; i++ ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
return i;
}
}
代码示例来源:origin: M66B/XPrivacyLua
public Varargs invoke(Varargs args) {
return args.checktable(1).next(args.arg(2));
}
}
代码示例来源:origin: com.cloudera.kitten/kitten-common
private void step() {
this.varargs = array ? t.inext(currentKey) : t.next(currentKey);
currentKey = varargs.arg1();
}
}
代码示例来源:origin: mirkosertic/GameComposer
/** This may be deprecated in a future release.
* It is recommended to count via iteration over next() instead
* @return count of keys in the table
* */
public int keyCount() {
LuaValue k = LuaValue.NIL;
for ( int i=0; true; i++ ) {
Varargs n = next(k);
if ( (k = n.arg1()).isnil() )
return i;
}
}
代码示例来源:origin: mirkosertic/GameComposer
@Override
public Varargs invoke(Varargs args) {
return args.checktable(1).next(args.arg(2));
}
}
代码示例来源:origin: hsllany/HtmlNative
public Varargs invoke(Varargs args) {
return args.checktable(1).next(args.arg(2));
}
}
代码示例来源:origin: Tencent/RapidView
private List<IRapidView> translateList(LuaTable table){
LuaValue key = LuaValue.NIL;
LuaValue value = LuaValue.NIL;
List<IRapidView> list = new ArrayList<IRapidView>();
if( table == null || !table.istable() ){
return list;
}
while(true){
Object obj = null;
Varargs argsItem = table.next(key);
key = argsItem.arg1();
if( key.isnil() ){
break;
}
value = argsItem.arg(2);
obj = CoerceLuaToJava.coerce(value, Object.class);
if( obj instanceof IRapidView ){
list.add((IRapidView)obj);
}
}
return list;
}
代码示例来源:origin: Tencent/RapidView
public static Map<String, Var> table2Map(LuaTable table){
LuaValue key = LuaValue.NIL;
LuaValue value = LuaValue.NIL;
Map<String, Var> map = new ConcurrentHashMap<String, Var>();
if( table == null || !table.istable() ){
return null;
}
while(true){
Varargs argsItem = table.next(key);
key = argsItem.arg1();
if( key.isnil() ){
break;
}
value = argsItem.arg(2);
if( key.isstring() ){
map.put(key.toString(), new Var(value));
}
}
return map;
}
}
代码示例来源:origin: Tencent/RapidView
private void addData(String view, LuaTable data){
LuaValue key = LuaValue.NIL;
LuaValue value = LuaValue.NIL;
Map<String, Var> map = new ConcurrentHashMap<String, Var>();
while(true){
Varargs argsItem = data.next(key);
key = argsItem.arg1();
Var var = null;
if( key.isnil() ){
break;
}
value = argsItem.arg(2);
if( !value.isuserdata() || !(value.touserdata() instanceof Var) ){
var = new Var(value);
}
else{
var = (Var)value.touserdata();
}
if( key.isstring() ){
map.put(key.toString(), var);
}
}
mListViewName.add(view);
mListData.add(map);
}
代码示例来源:origin: Tencent/RapidView
public static Map<String, Var> translateData(LuaTable data){
LuaValue key = LuaValue.NIL;
LuaValue value = LuaValue.NIL;
Map<String, Var> map = new ConcurrentHashMap<String, Var>();
if( data == null || !data.istable() ){
return map;
}
while(true){
Varargs argsItem = data.next(key);
key = argsItem.arg1();
if( key.isnil() ){
break;
}
value = argsItem.arg(2);
if( key.isstring() ){
map.put(key.toString(), new Var(value));
}
}
return map;
}
代码示例来源:origin: info.bliki.wiki/bliki-core
@Override
public LuaValue call(LuaValue frameId, LuaValue title, LuaValue args) {
final Frame frame = getFrameById(frameId);
final Map<String, String> parameterMap = frame.getTemplateParameters();
final LuaTable table = args.checktable();
LuaValue key = LuaValue.NIL;
while (true) {
Varargs next = table.next(key);
if ((key = next.arg1()).isnil())
break;
LuaValue value = next.arg(2);
parameterMap.put(key.checkjstring(), value.checkjstring());
}
StringWriter writer = new StringWriter();
try {
model.substituteTemplateCall(title.tojstring(), parameterMap, writer);
return toLuaString(writer.toString());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
代码示例来源:origin: RS485/LogisticsPipes
public static LuaTable onCCWrappedILuaObject(final LuaTable table, final ILuaObject object) {
if (object instanceof CCCommandWrapper) {
LuaTable lpTable = new LPLuaTable((CCCommandWrapper) object);
LuaValue k = LuaValue.NIL;
while (true) {
Varargs n = table.next(k);
if ((k = n.arg1()).isnil()) {
break;
}
LuaValue v = n.arg(2);
lpTable.set(k, v);
}
((CCCommandWrapper) object).table = lpTable;
return lpTable;
}
return table;
}
代码示例来源:origin: com.aerospike/aerospike-client
@Override
public Varargs invoke(Varargs args) {
int capacity = 32;
if (args.isnumber(1)) {
capacity = args.toint(1);
}
LuaList list = new LuaList(instance, new ArrayList<LuaValue>(capacity));
if (args.istable(2)) {
LuaTable table = args.checktable(2);
LuaValue k = LuaValue.NIL;
while (true) {
Varargs n = table.next(k);
if ((k = n.arg1()).isnil())
break;
LuaValue v = n.arg(2);
list.append(v);
}
}
return list;
}
}
代码示例来源:origin: aerospike/aerospike-client-java
@Override
public Varargs invoke(Varargs args) {
int capacity = 32;
if (args.isnumber(1)) {
capacity = args.toint(1);
}
LuaList list = new LuaList(instance, new ArrayList<LuaValue>(capacity));
if (args.istable(2)) {
LuaTable table = args.checktable(2);
LuaValue k = LuaValue.NIL;
while (true) {
Varargs n = table.next(k);
if ((k = n.arg1()).isnil())
break;
LuaValue v = n.arg(2);
list.append(v);
}
}
return list;
}
}
代码示例来源:origin: com.aerospike/aerospike-client
@Override
public Varargs invoke(Varargs args) {
int capacity = 32;
if (args.isnumber(1)) {
capacity = args.toint(1);
}
LuaMap map = new LuaMap(instance, new HashMap<LuaValue,LuaValue>(capacity));
if (args.istable(2)) {
LuaTable table = args.checktable(2);
LuaValue k = LuaValue.NIL;
while (true) {
Varargs n = table.next(k);
if ((k = n.arg1()).isnil())
break;
LuaValue v = n.arg(2);
map.put(k, v);
}
}
return map;
}
}
代码示例来源:origin: Tencent/RapidView
private void setHeader(LuaTable header){
LuaValue key = LuaValue.NIL;
LuaValue value = LuaValue.NIL;
if( header != null && header.istable() ){
while(true){
Varargs argsItem = header.next(key);
key = argsItem.arg1();
if( key.isnil() ){
break;
}
value = argsItem.arg(2);
if( key.isstring() && value.isstring() ){
addHeader(key.toString(), value.toString());
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!