本文整理匯總了Java中org.luaj.vm2.LuaValue.NIL屬性的典型用法代碼示例。如果您正苦於以下問題:Java LuaValue.NIL屬性的具體用法?Java LuaValue.NIL怎麽用?Java LuaValue.NIL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.luaj.vm2.LuaValue
的用法示例。
在下文中一共展示了LuaValue.NIL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: invoke
@Override
public LuaValue invoke(Varargs args) {
final LuaValue target = args.arg(2);
final LuaValue callback = LuaUtil.getFunction(args, 3);
if(callback != null){//通過callback來處理
new SimpleTask1<LuaValue>() {
@Override
protected LuaValue doInBackground(Object... params) {
return isValid(target);
}
@Override
protected void onPostExecute(LuaValue result) {
LuaUtil.callFunction(callback, result);
}
}.executeInPool();
return LuaValue.NIL;
} else {
return isValid(target);
}
}
示例2: onCalled
@Override
public LuaValue onCalled(Varargs parameters) {
String key = parameters.arg(1).tojstring();
Properties map = new Properties();
File dir = new File(LukkitPlus.PLUGINS_FOLDER, plugin.getName());
if (!dir.exists()) {
return LuaValue.NIL;
}
File file = new File(dir, "datastore.data");
if (!file.exists()) {
return LuaValue.NIL;
}
try {
map = StoreInfo.getData(file);
} catch (Exception e) {
e.printStackTrace();
}
if (!map.containsKey(key)) {
return LuaValue.NIL;
}
return LuaValue.valueOf(map.getProperty(key));
}
示例3: toTable
/**
* convert params to LuaTable
*
* @param params
* @return
*/
public static LuaValue toTable(List<?> params) {
if (params != null) {
final LuaTable result = new LuaTable();
if (params.size() > 0) {
Object value = null;
for (int i = 0; i < params.size(); i++) {
value = params.get(i);
result.set(i + 1, toLuaValue(value));
}
}
return result;
}
return LuaValue.NIL;
}
示例4: getOrCallFunction
public static LuaValue getOrCallFunction(LuaValue target, LuaValue arg1, LuaValue arg2) {
try {
return (target != null && target.isfunction()) ? target.call(arg1, arg2) : target;
} catch (Exception e) {
e.printStackTrace();
return LuaValue.NIL;
}
}
示例5: onCalled
@Override
public LuaValue onCalled(Varargs parameters) {
String name = parameters.arg(1).tojstring();
for (Field field : object.getClass().getFields()) {
field.setAccessible(true);
if (field.getName().equals(name)) {
try {
return convertType(field.get(object));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return LuaValue.NIL;
}
示例6: invokeFunction
public static Varargs invokeFunction(LuaValue target, LuaValue arg1, LuaValue arg2, LuaValue arg3) {
try {
return (target != null && target.isfunction()) ? target.invoke(new LuaValue[]{arg1, arg2, arg3}) : LuaValue.NIL;
} catch (Exception e) {
e.printStackTrace();
return LuaValue.NIL;
}
}
示例7: createSprite
private LuaValue createSprite(final int x, final int y, final int width, final int height) {
if (mBitmap != null) {
UDBitmap bitmap = new UDBitmap(getGlobals(), getmetatable(), null);
try {
bitmap.mBitmap = Bitmap.createBitmap(mBitmap, x, y, width, height);
return bitmap;
} catch (Throwable e){
e.printStackTrace();
LogUtil.e("[LuaView-Error] Bitmap.createSprite failed", x, y, width, height, "Error!");
}
}
return LuaValue.NIL;
}
示例8: notNull
static boolean notNull(LuaValue... values) {
for (LuaValue v : values) {
if (v == LuaValue.NIL) {
return false;
}
}
return true;
}
示例9: getText
/**
* get text of given value
*
* @param inputValue
* @return
*/
public static CharSequence getText(LuaValue inputValue) {
final LuaValue result = (inputValue != null && !inputValue.isnil()) ? inputValue : LuaValue.NIL;
if (result instanceof UDSpannableString) {
return ((UDSpannableString) result).getSpannableStringBuilder();
} else if (result instanceof UDUnicode) {
return result.toString();
} else {
return result.optjstring("");
}
}
示例10: toLuaTable
/**
* 將JSONObject轉成LuaTable
*
* @param jsonString
* @return
*/
public static LuaValue toLuaTable(String jsonString) {
LuaValue luaTable = LuaValue.NIL;
try {
luaTable = toLuaTable(new JSONObject(jsonString));
} catch (Exception e) {
try {
luaTable = toLuaTable(new JSONArray(jsonString));
} catch (JSONException ex1) {
LogUtil.e("[LuaView Error-toLuaTable]-Json Parse Failed, Reason: Invalid Format!", ex1);
}
}
return luaTable;
}
示例11: onCalled
@Override
public LuaValue onCalled(Varargs parameters) {
Bukkit.broadcastMessage(parameters.arg(1).tojstring());
return LuaValue.NIL;
}
示例12: onCalled
@Override
public LuaValue onCalled(Varargs parameters) {
plugin.setDisableHandler(parameters.arg(1));
return LuaValue.NIL;
}
示例13: getImage
public LuaValue getImage(U view, Varargs varargs) {
String imageUrl = view.getImageUrl();
return imageUrl != null ? valueOf(imageUrl) : LuaValue.NIL;
}
示例14: onCalled
@Override
public LuaValue onCalled(Varargs parameters) {
logger.severe(colorString(parameters.arg(1).tojstring()));
return LuaValue.NIL;
}
示例15: coerce
/**
* Coerse a Java object to a corresponding lua value.
* <p>
* Integral types {@code boolean}, {@code byte}, {@code char}, and {@code int}
* will become {@link LuaInteger};
* {@code long}, {@code float}, and {@code double} will become {@link LuaDouble};
* {@code String} and {@code byte[]} will become {@link LuaString};
* types inheriting from {@link LuaValue} will be returned without coercion;
* other types will become {@link LuaUserdata}.
* @param o Java object needing conversion
* @return {@link LuaValue} corresponding to the supplied Java value.
* @see LuaValue
* @see LuaInteger
* @see LuaDouble
* @see LuaString
* @see LuaUserdata
*/
public static LuaValue coerce(Object o) {
if ( o == null )
return LuaValue.NIL;
Class clazz = o.getClass();
Coercion c = (Coercion) COERCIONS.get( clazz );
if ( c == null ) {
c = clazz.isArray()? arrayCoercion:
o instanceof LuaValue ? luaCoercion:
instanceCoercion;
COERCIONS.put( clazz, c );
}
return c.coerce(o);
}