use of org.luaj.vm2.LuaTable in project LuaViewSDK by alibaba.
the class DebugLib method call.
public LuaValue call(LuaValue modname, LuaValue env) {
globals = env.checkglobals();
globals.debuglib = this;
LuaTable debug = new LuaTable();
debug.set("debug", new debug());
debug.set("gethook", new gethook());
debug.set("getinfo", new getinfo());
debug.set("getlocal", new getlocal());
debug.set("getmetatable", new getmetatable());
debug.set("getregistry", new getregistry());
debug.set("getupvalue", new getupvalue());
debug.set("getuservalue", new getuservalue());
debug.set("sethook", new sethook());
debug.set("setlocal", new setlocal());
debug.set("setmetatable", new setmetatable());
debug.set("setupvalue", new setupvalue());
debug.set("setuservalue", new setuservalue());
debug.set("traceback", new traceback());
debug.set("upvalueid", new upvalueid());
debug.set("upvaluejoin", new upvaluejoin());
debug.set("traceback_count", new tracebackCount());
//extend for luaview
new com.taobao.luaview.vm.extend.DebugLib(this, globals).extend(debug);
env.set("debug", debug);
env.get("package").get("loaded").set("debug", debug);
return debug;
}
use of org.luaj.vm2.LuaTable in project LuaViewSDK by alibaba.
the class MathLib method call.
public LuaValue call(LuaValue modname, LuaValue env) {
LuaTable math = new LuaTable(0, 30);
math.set("abs", new abs());
math.set("ceil", new ceil());
math.set("cos", new cos());
math.set("deg", new deg());
math.set("exp", new exp(this));
math.set("floor", new floor());
math.set("fmod", new fmod());
math.set("frexp", new frexp());
math.set("huge", LuaDouble.POSINF);
math.set("ldexp", new ldexp());
math.set("max", new max());
math.set("min", new min());
math.set("modf", new modf());
math.set("pi", Math.PI);
math.set("pow", new pow());
random r;
math.set("random", r = new random());
math.set("randomseed", new randomseed(r));
math.set("rad", new rad());
math.set("sin", new sin());
math.set("sqrt", new sqrt());
math.set("tan", new tan());
env.set("math", math);
env.get("package").get("loaded").set("math", math);
return math;
}
use of org.luaj.vm2.LuaTable in project LogisticsPipes by RS485.
the class LPASMHookCC method onCCWrappedILuaObject.
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;
}
use of org.luaj.vm2.LuaTable in project aerospike-client-java by aerospike.
the class LuaAerospikeLib method call.
public LuaValue call(LuaValue env) {
LuaTable meta = new LuaTable();
meta.set("__index", new index());
LuaTable table = new LuaTable();
table.setmetatable(meta);
instance.registerPackage("aerospike", table);
return table;
}
use of org.luaj.vm2.LuaTable in project aerospike-client-java by aerospike.
the class LuaBytesLib method call.
public LuaValue call(LuaValue env) {
LuaTable meta = new LuaTable(0, 2);
meta.set("__call", new create(instance));
LuaTable table = new LuaTable(0, 50);
table.setmetatable(meta);
new bytescode(table, 0, "size");
new bytescode(table, 2, "get_byte");
new bytescode(table, 3, "get_type");
new bytescode(table, 4, "get_string");
new bytescode(table, 5, "get_bytes");
new bytescode(table, 6, "get_int16");
new bytescode(table, 6, "get_int16_be");
new bytescode(table, 7, "get_int16_le");
new bytescode(table, 8, "get_int32");
new bytescode(table, 8, "get_int32_be");
new bytescode(table, 9, "get_int32_le");
new bytescode(table, 10, "get_int64");
new bytescode(table, 10, "get_int64_be");
new bytescode(table, 11, "get_int64_le");
new bytescode(table, 12, "get_var_int");
new bytescode(table, 13, "set_var_int");
new bytescode(table, 14, "append_var_int");
new bytesbool(table, 0, "set_byte");
new bytesbool(table, 1, "set_size");
new bytesbool(table, 2, "set_type");
new bytesbool(table, 3, "set_string");
new bytesbool(table, 4, "set_bytes");
new bytesbool(table, 5, "set_int16");
new bytesbool(table, 5, "set_int16_be");
new bytesbool(table, 6, "set_int16_le");
new bytesbool(table, 7, "set_int32");
new bytesbool(table, 7, "set_int32_be");
new bytesbool(table, 8, "set_int32_le");
new bytesbool(table, 9, "set_int64");
new bytesbool(table, 9, "set_int64_be");
new bytesbool(table, 10, "set_int64_le");
new bytesbool(table, 11, "append_string");
new bytesbool(table, 12, "append_bytes");
new bytesbool(table, 13, "append_byte");
new bytesbool(table, 14, "append_int16");
new bytesbool(table, 14, "append_int16_be");
new bytesbool(table, 15, "append_int16_le");
new bytesbool(table, 16, "append_int32");
new bytesbool(table, 16, "append_int32_be");
new bytesbool(table, 17, "append_int32_le");
new bytesbool(table, 18, "append_int64");
new bytesbool(table, 18, "append_int64_be");
new bytesbool(table, 19, "append_int64_le");
instance.registerPackage("bytes", table);
return table;
}
Aggregations