public LuaValue call(LuaValue arg1, LuaValue arg2) { return arg1.checktable().rawget(arg2); } }
/** Return argument i as a LuaTable if a lua table, or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @return LuaTable value if a table * @exception LuaError if the argument is not a lua table * */ public LuaTable checktable(int i) { return arg(i).checktable(); }
/** Return argument i as a LuaTable if a lua table, or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @return LuaTable value if a table * @exception LuaError if the argument is not a lua table * */ public LuaTable checktable(int i) { return arg(i).checktable(); }
@Override public LuaValue call(LuaValue arg1, LuaValue arg2) { return arg1.checktable().rawget(arg2); } }
@Override public LuaValue call(LuaValue arg) { // TODO: is this correct? return arg.checktable().len(); } });
public LuaValue call(LuaValue arg1, LuaValue arg2) { return arg1.checktable().rawget(arg2); } }
@Override public LuaValue call(LuaValue list, LuaValue pos) { return list.checktable().remove(pos.checkint()); } }
public LuaValue call(LuaValue table, LuaValue index, LuaValue value) { LuaTable t = table.checktable(); t.rawset(index.checknotnil(), value); return t; } }
public LuaValue call(LuaValue table, LuaValue index, LuaValue value) { LuaTable t = table.checktable(); t.rawset(index.checknotnil(), value); return t; } }
@Override public LuaValue call(LuaValue list) { return list.checktable().concat(EMPTYSTRING,1,list.length()); } @Override
public LuaValue call(LuaValue list) { return list.checktable().concat(EMPTYSTRING,1,list.length()); } public LuaValue call(LuaValue list, LuaValue sep) {
public Varargs invoke(Varargs args) { return args.arg1().checktable().remove(args.optint(2, 0)); } }
public LuaValue call(LuaValue table, LuaValue metatable) { final LuaValue mt0 = table.checktable().getmetatable(); if (mt0 != null && !mt0.rawget(METATABLE).isnil()) { error("cannot change a protected metatable"); } return table.setmetatable(metatable.isnil() ? null : metatable.checktable()); } }
public LuaValue call(LuaValue table, LuaValue metatable) { final LuaValue mt0 = table.checktable().getmetatable(); if ( mt0!=null && !mt0.rawget(METATABLE).isnil() ) error("cannot change a protected metatable"); return table.setmetatable(metatable.isnil()? null: metatable.checktable()); } }
@Override public LuaValue call(LuaValue path, LuaValue table) { plugin.getConfig().createSection(path.checkjstring(), convertToMap(table.checktable())); return LuaValue.NIL; } });
@Override public LuaValue call(LuaValue arg) { if (arg.isnil()) { return LuaValue.error("bad argument #1 to 'getn' (table expected, got nil)"); } else { return arg.checktable().len(); } } });
public LuaValue call(LuaValue list, LuaValue sep) { return list.checktable().concat(sep.checkstring(),1,list.length()); } public LuaValue call(LuaValue list, LuaValue sep, LuaValue i) {
public LuaValue call(LuaValue list, LuaValue sep, LuaValue i) { return list.checktable().concat(sep.checkstring(),i.checkint(),list.length()); } public LuaValue call(LuaValue list, LuaValue sep, LuaValue i, LuaValue j) {
public Varargs invoke(Varargs args) { args.arg1().checktable().sort( args.arg(2).isnil()? NIL: args.arg(2).checkfunction()); return NONE; } }
public Varargs invoke(Varargs args) { args.arg1().checktable().sort( args.arg(2).isnil()? NIL: args.arg(2).checkfunction()); return NONE; } }