本文整理匯總了Java中org.luaj.vm2.LuaValue.tojstring方法的典型用法代碼示例。如果您正苦於以下問題:Java LuaValue.tojstring方法的具體用法?Java LuaValue.tojstring怎麽用?Java LuaValue.tojstring使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.luaj.vm2.LuaValue
的用法示例。
在下文中一共展示了LuaValue.tojstring方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: coerce
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public Object coerce(LuaValue value) {
switch ( value.type() ) {
case LuaValue.TNUMBER:
return value.isint()? (Object)new Integer(value.toint()): (Object)new Double(value.todouble());
case LuaValue.TBOOLEAN:
return value.toboolean()? Boolean.TRUE: Boolean.FALSE;
case LuaValue.TSTRING:
return value.tojstring();
case LuaValue.TUSERDATA:
return value.optuserdata(targetType, null);
case LuaValue.TNIL:
return null;
default:
return value;
}
}
示例2: call
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
@Override
public LuaValue call(LuaValue arg) {
String id = arg.tojstring();
View v = mContext.findViewById(id);
if (v != null) {
LView lView = new LView(v, mContext);
lView.mAdded = true;
return lView;
}
return NIL;
}
示例3: process
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
@Override
public String process(GuildMessageReceivedEvent event, String input, Map<String, String> mappings) {
try {
LuaEvaluator evaluator = new LuaEvaluator(new ThrowAwayClassLoader(), 20000)
.removePackage()
.removeOS()
.removeLuajava()
.removeIO()
.remove("Java")
.remove("loadfile")
.remove("dofile")
.remove("print");
evaluator
.set("input", input)
.set("args", input.split("\\s+"))
.set("mappings", mappings)
.set("event", new SafeGuildMessageReceivedEvent(event, 0));
LuaValue ret = evaluator.eval(code);
return ret.isnil() ? "No returns" : ret.tojstring();
} catch (LuaError error) {
Throwable cause = error.getCause();
if (cause instanceof CycleLimitExceededException) {
return "Cycle limit exceeded";
}
if (cause != null) return "Error executing: " + cause;
return error.getMessage();
}
}
示例4: call
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public LuaValue call(LuaValue arg1, LuaValue arg2) {
throw new LuaError(arg1.isnil() ? null : arg1.tojstring(), arg2.optint(1));
}
示例5: call
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public LuaValue call(LuaValue arg1, LuaValue arg2) {
throw arg1.isnil() ? new LuaError(null, arg2.optint(1)) : arg1.isstring() ? new
LuaError(arg1.tojstring(), arg2.optint(1)) : new LuaError(arg1);
}
示例6: call
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public LuaValue call(LuaValue arg1, LuaValue arg2) {
throw arg1.isnil()? new LuaError(null, arg2.optint(1)):
arg1.isstring()? new LuaError(arg1.tojstring(), arg2.optint(1)):
new LuaError(arg1);
}