// Use this for initialization void Start() { InitLuaPath(); mLuaState.Start(); mLuaState.DoFile("Main.lua"); if (DebugMode()) { NGUIDebug.debugRaycast = true; NGUIDebug.Log(LuaConst.luaDir); NGUIDebug.Log(LuaConst.toluaDir); } LuaHelper.CallFunction("Main", "Start"); //string[] array = new string[2]; //array[0] = "first"; //array[1] = "second"; //LuaHelper.CallFunction("Main", "Test1",array); }
static int CallFunction(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); string arg0 = ToLua.CheckString(L, 1); object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); object[] o = LuaHelper.CallFunction(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void OnInit() { LuaState = new LuaState(); this.OpenLibs(); LuaState.LuaSetTop(0); LuaBinder.Bind(LuaState); LuaCoroutine.Register(LuaState, this); #if UNITY_EDITOR if (!string.IsNullOrEmpty(LuaConst.luaDir)) { foreach (var subDir in Directory.GetDirectories(LuaConst.luaDir, "*", SearchOption.AllDirectories)) { LuaState.AddSearchPath(subDir); } } #endif LuaState.Start(); LuaHelper.CallFunction("Main.Init"); }
void OnGUI() { if (GUILayout.Button("MapEditor")) { SwitchToEditScene(); } if (GUILayout.Button("StartLua")) { StartLua(); } if (GUILayout.Button("StartBattle")) { StartBattle(); } if (GUILayout.Button("SwitchToCastle")) { SwitchToCastle(); } if (GUILayout.Button("ShowMap")) { SwitchToMapScene(); } if (GUILayout.Button("StartLuaDebugger")) { LuaHelper.CallFunction("LuaScriptHelper.StartDebugger"); } //if (GUILayout.Button("TestBattleUI")) //{ // Game.StartCoroutine(TestBattleUI()); //} }
private void BindLuaInternal() { LuaHelper.LoadFile(m_LuaName); LuaHelper.CallFunction("LuaOutLetHelper.BindLua", this, LuaManager.Instance.LuaState[m_LuaName]); }
public static void TestProtobuf(ByteBuffer buffer) { LuaHelper.CallFunction("Test", "TestParseProtobuf", buffer); }
private void OnLevelWasLoaded(int level) { LuaHelper.CallFunction("Main", "OnLevelWasLoaded", level); }
private void OnApplicationQuit() { LuaHelper.CallFunction("Main", "OnApplicationQuit"); }