/** Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, * or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @param c the class to which the userdata instance must be assignable * @return java Object value if argument i is a userdata whose instance Class c or a subclass * @exception LuaError if the argument is not a userdata or from whose instance c is not assignable * */ public Object checkuserdata(int i,Class c) { return arg(i).checkuserdata(c); }
/** Return argument i as a java Object if a userdata, or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @return java Object value if argument i is a userdata * @exception LuaError if the argument is not a userdata * */ public Object checkuserdata(int i) { return arg(i).checkuserdata(); }
/** Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, * or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @param c the class to which the userdata instance must be assignable * @return java Object value if argument i is a userdata whose instance Class c or a subclass * @exception LuaError if the argument is not a userdata or from whose instance c is not assignable * */ public Object checkuserdata(int i,Class c) { return arg(i).checkuserdata(c); }
/** Return argument i as a java Object if a userdata, or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @return java Object value if argument i is a userdata * @exception LuaError if the argument is not a userdata * */ public Object checkuserdata(int i) { return arg(i).checkuserdata(); }
/** Return argument i as a java Object if a userdata, or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @return java Object value if argument i is a userdata * @exception LuaError if the argument is not a userdata * */ public Object checkuserdata(int i) { return arg(i).checkuserdata(); }
/** Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, * or throw an error if any other type. * @param i the index of the argument to test, 1 is the first argument * @param c the class to which the userdata instance must be assignable * @return java Object value if argument i is a userdata whose instance Class c or a subclass * @exception LuaError if the argument is not a userdata or from whose instance c is not assignable * */ public Object checkuserdata(int i,Class c) { return arg(i).checkuserdata(c); }
@Override public LuaValue call(LuaValue value) { item.setData((MaterialData) value.checkuserdata(MaterialData.class)); return NIL; } });
@Override public LuaValue call(LuaValue value) { item.setType((Material) value.checkuserdata(Material.class)); return NIL; } });
@Override public LuaValue call(LuaValue value) { meta = (ItemMeta) value.checkuserdata(ItemMeta.class); item.setItemMeta(meta); return NIL; } });
public LuaValue call(LuaValue arg) { return invokeMethod(arg.checkuserdata(), LuaValue.NONE); }
public LuaValue call(LuaValue arg1, LuaValue arg2) { return invokeBestMethod(arg1.checkuserdata(), arg2); }
public LuaValue call(LuaValue arg) { return invokeMethod(arg.checkuserdata(), LuaValue.NONE); }
@Override public LuaValue call(LuaValue value) { return CoerceJavaToLua.coerce(item.getEnchantmentLevel((Enchantment) value.checkuserdata(Enchantment.class))); } });
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; } }
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; } }
@Override public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata)args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; } }
@Override public LuaValue call(LuaValue arg) { Map<?, ?> map; if (arg.checkuserdata() instanceof Map) { map = (Map<?, ?>) arg.touserdata(); } else { throw new LukkitPluginException("util.tableFromMap(obj) was passed something other than a implementation of Map."); } LuaTable t = new LuaTable(); map.forEach((k, v) -> t.set(CoerceJavaToLua.coerce(k), CoerceJavaToLua.coerce(v))); return t; } });
@Override public LuaValue call(LuaValue item) { if (!item.isnil() && !(item.checkuserdata() instanceof ItemStack)) { throw new LukkitPluginException("parseItemStack was given something other than an ItemStack"); } return CoerceJavaToLua.coerce(new ItemStackWrapper((ItemStack) item.touserdata())); } });
@Override public LuaValue call(LuaValue item) { if (!item.isnil() && !(item.checkuserdata() instanceof ItemStack)) { throw new LukkitPluginException("bukkit.getSkullMeta was passed something other than an ItemStack."); } return CoerceJavaToLua.coerce(new SkullWrapper((item.isnil()) ? null : (ItemStack) item.touserdata())); } });
@Override public LuaValue call(LuaValue item) { if (!item.isnil() && !(item.checkuserdata() instanceof ItemStack)) { throw new LukkitPluginException("bukkit.getBannerMeta was passed something other than an ItemStack."); } return CoerceJavaToLua.coerce(new BannerWrapper((item.isnil()) ? null : (ItemStack) item.touserdata())); } });