public static int ClrFuncCoroutine(IntPtr l) { var oldtop = l.gettop(); if (l.isfunction(1)) { var lfunc = new LuaOnStackFunc(l, 1); var co = GlobalLua.StartLuaCoroutine(lfunc); l.settop(oldtop); l.PushLua(co); } return(l.gettop() - oldtop); }
public static int ClrFuncBehavCoroutine(IntPtr l) { var oldtop = l.gettop(); if (l.IsObject(1) && l.isfunction(2)) { var behav = l.GetLua <UnityEngine.MonoBehaviour>(1); var lfunc = new LuaOnStackFunc(l, 2); var co = GlobalLua.StartLuaCoroutineForBehav(behav, lfunc); l.settop(oldtop); l.PushLua(co); } return(l.gettop() - oldtop); }
//public void EditorPrepareLuaRes() //{ // ResManager.ResLoader.Init(); // LanguageConverter.Init(); //} void Awake() { #if UNITY_EDITOR var awaken = GlobalLua.L["___EDITOR_AWAKEN"].ConvertType <int>(); if (awaken == 0) { GlobalLua.EditorCheckRunningState(); GlobalLua.L["___EDITOR_AWAKEN"] = 1; //Init(); //EditorPrepareLuaRes(); //var l = GlobalLua.L.L; //l.pushcfunction(LuaHub.LuaFuncOnError); // err //l.GetGlobal("require"); // err require //l.PushString("init"); // err require "main" //if (l.pcall(1, 0, -3) == 0) //{ // l.pop(1); //} //else //{ // DynamicHelper.LogError(l.GetLua(-1)); // l.pop(2); //} } #endif BindLua(); LanguageConverter.IterateText(transform); _Awaken = true; if (_DestroyRegIndex > 0) { RemoveDestroyRegIndex(_DestroyRegIndex); _DestroyRegIndex = 0; } CallLuaFunc("awake"); // Notice! The awake will NOT be called for the runtime binded behaviours! }
private static void GlobalLuaInitLua() { GlobalLua.Init(); InitLua(GlobalLua.L.L); }
private static void ReinitGlobalLua() { GlobalLua.Reinit(); }