use of org.luaj.vm2.LuaTable in project love-android by hagish.
the class LuaUtils method getFromTableByPath.
public static LuaValue getFromTableByPath(LuaTable t, String path) {
String[] pathParts = path.split("\\.");
LuaValue cur = t;
for (String part : pathParts) {
LuaValue next = cur.get(part);
if (next.equals(LuaValue.NIL)) {
cur = next;
break;
} else {
cur = next;
}
}
return cur;
}
use of org.luaj.vm2.LuaTable in project kitten by cloudera.
the class LuaWrapper method createTable.
public LuaWrapper createTable(String name) {
LuaTable lt = new LuaTable();
env.set(name, lt);
return new LuaWrapper(lt);
}
use of org.luaj.vm2.LuaTable in project LuaViewSDK by alibaba.
the class CustomError method initPanel.
@Override
public void initPanel() {
Button button = new Button(getContext());
button.setText("Error");
LayoutParams relativeLayout = LuaViewUtil.createRelativeLayoutParamsWW();
relativeLayout.addRule(RelativeLayout.CENTER_IN_PARENT);
addView(button, relativeLayout);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LuaTable table = new LuaTable();
table.insert(1, LuaValue.valueOf(1.4));
callLuaCallback("Message", "Error", 100, new Object(), table);
}
});
}
use of org.luaj.vm2.LuaTable in project LuaViewSDK by alibaba.
the class LuaViewManager method bind.
/**
* bind lua functions using opcode
*
* @param factory
* @param methods
* @return
*/
public static LuaTable bind(Class<? extends LibFunction> factory, List<String> methods) {
LuaTable env = new LuaTable();
try {
if (methods != null) {
for (int i = 0; i < methods.size(); i++) {
LibFunction f = factory.newInstance();
f.opcode = i;
f.method = null;
f.name = methods.get(i);
env.set(f.name, f);
}
}
} catch (Exception e) {
throw new LuaError("[Bind Failed] " + e);
} finally {
return env;
}
}
use of org.luaj.vm2.LuaTable in project LuaViewSDK by alibaba.
the class HttpMethodMapper method get.
/**
* get请求
*
* @param http
* @param varargs
* @return
*/
public LuaValue get(U http, Varargs varargs) {
final String url = LuaUtil.getString(varargs, 2);
final LuaTable params = LuaUtil.getTable(varargs, 3, 2);
final LuaFunction callback = LuaUtil.getFunction(varargs, 4, 3, 2);
return http.get(url, params, callback);
}
Aggregations