Exemple #1
0
        public LuaSvr(string main)
        {
            luaState = new LuaState();

            LuaObject.init(luaState.handle);
            bind("BindUnity");
            bind("BindUnityUI");
            bind("BindCustom");

            if (LuaDLL.lua_gettop(luaState.handle) != 0)
            {
                Debug.LogError("Some function not remove temp value from lua stack.");
            }

            GameObject       go  = new GameObject("LuaSvrProxy");
            LuaSvrGameObject lgo = go.AddComponent <LuaSvrGameObject>();

            GameObject.DontDestroyOnLoad(go);
            lgo.state = luaState;


            luaState.doFile(main);

            LuaFunction func = (LuaFunction)luaState["main"];

            func.call();
        }
Exemple #2
0
 public void start(string main)
 {
     if (main != null)
     {
         luaState.doFile(main);
         LuaFunction func = (LuaFunction)luaState["main"];
         func.call();
     }
 }
Exemple #3
0
 public object start(string main)
 {
     if (main != null)
     {
         luaState.doFile(main);
         LuaFunction func = (LuaFunction)luaState["main"];
         if (func != null)
         {
             return(func.call());
         }
     }
     return(null);
 }