use of org.luaj.vm2.Globals in project LuaViewSDK by alibaba.
the class LVCustomViewPagerIndicator method createView.
/**
* create view
*
* @param pos
* @return
*/
private LuaValue createView(int pos, int currentItem) {
Globals globals = this.mLuaUserdata.getGlobals();
//View封装
final LVViewGroup container = createCellLayout();
final UDViewGroup cell = new UDViewGroup(container, globals, null);
//对外数据封装,必须使用LuaTable
final UDLuaTable cellData = new UDLuaTable(cell);
//call init
globals.saveContainer(container);
//初始化
this.mLuaUserdata.callCellInit(cellData, pos, currentItem);
globals.restoreContainer();
//set tag
View view = cellData.getView();
if (view != null) {
view.setTag(Constants.RES_LV_TAG, cellData);
}
return cellData;
}
use of org.luaj.vm2.Globals in project LuaViewSDK by alibaba.
the class OsLib method call.
public LuaValue call(LuaValue modname, LuaValue env) {
globals = env.checkglobals();
LuaTable os = new LuaTable();
for (int i = 0; i < NAMES.length; ++i) os.set(NAMES[i], new OsLibFunc(i, NAMES[i]));
env.set("os", os);
env.get("package").get("loaded").set("os", os);
return os;
}
use of org.luaj.vm2.Globals in project LuaViewSDK by alibaba.
the class PackageLib method call.
public LuaValue call(LuaValue modname, LuaValue env) {
globals = env.checkglobals();
globals.set("require", new require());
package_ = new LuaTable();
package_.set(_LOADED, new LuaTable());
package_.set(_PRELOAD, new LuaTable());
package_.set(_PATH, LuaValue.valueOf(DEFAULT_LUA_PATH));
package_.set(_LOADLIB, new loadlib());
package_.set(_SEARCHPATH, new searchpath());
LuaTable searchers = new LuaTable();
searchers.set(1, preload_searcher = new preload_searcher());
searchers.set(2, lua_searcher = new lua_searcher());
searchers.set(3, java_searcher = new java_searcher());
package_.set(_SEARCHERS, searchers);
package_.get(_LOADED).set("package", package_);
env.set("package", package_);
globals.package_ = this;
return env;
}
use of org.luaj.vm2.Globals 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.Globals in project LuaViewSDK by alibaba.
the class JsePlatform method debugGlobals.
/** Create standard globals including the {@link debug} library.
*
* @return Table of globals initialized with the standard JSE and debug libraries
* @see #standardGlobals()
* @see JsePlatform
* @see JmePlatform
* @see DebugLib
*/
public static Globals debugGlobals() {
Globals globals = standardGlobals();
globals.load(new DebugLib());
return globals;
}
Aggregations