Beispiel #1
0
        public void init(Action <int> tick, Action complete, bool debug = false)
        {
            LuaState luaState = new LuaState();

            luaStateExt = new LuaStateExt(luaState);
            LuaDLL.open_luaext(luaState.L);
            LuaDLL.lua_settop(luaState.L, 0);

            IntPtr L = luaState.L;

            LuaObject.init(L);

            ThreadPool.QueueUserWorkItem(doBind, L);

            lgo.StartCoroutine(waitForBind(tick, () => {
                this.luaState = luaState;
                doinit(L);
                if (debug)
                {
                    lgo.StartCoroutine(waitForDebugConnection(() => {
                        complete();
                        checkTop(L);
                    }));
                }
                else
                {
                    complete();
                    checkTop(L);
                }
            }));
        }
Beispiel #2
0
        private void InitLua(string luaFilename, bool updatedScript)
        {
            luaState    = new LuaState();
            luaStateExt = new LuaStateExt(luaState);

            LuaDLL.open_luaext(luaState.L);
            LuaDLL.lua_settop(luaState.L, 0);

            byte [] scriptSource = null;
            if (updatedScript)
            {
                scriptSource = FileUtils.GetDataFromFile(luaFilename);
            }
            else
            {
                scriptSource = FileUtils.GetDataFromStreamingAssets(luaFilename);
            }

            object ret;
            var    ok = luaStateExt.doArc4Buffer(scriptSource, luaFilename, LBootApp.LUA_KEY, out ret);

            if (!ok)
            {
                LogUtil.Error("doArc4Buffer failed! " + luaFilename);
            }
        }
Beispiel #3
0
        public void initSync()
        {
            LuaState luaState = new LuaState();

            luaStateExt = new LuaStateExt(luaState);
            LuaDLL.open_luaext(luaState.L);
            LuaDLL.lua_settop(luaState.L, 0);

            IntPtr L = luaState.L;

            LuaObject.init(L);
            doBind(L);
            this.luaState = luaState;
            doinit(L);
            checkTop(L);
        }