public void Initialize() { Lua = new LuaEnv(); Lua.AddBuildin("rapidjson", XLua.LuaDLL.Lua.LoadRapidJson); if (LuaConst.DebugMode == true) { string path = Application.dataPath + "/XLua/EasyXLua/ToBuild/lua/"; GetAllFiles(new DirectoryInfo(path)); } else { if (LuaConst.LuaBundleMode) { string uri = LuaConst.DataPath + "Lua.medsci"; byte[] stream = File.ReadAllBytes(uri); AssetBundle bundle = AssetBundle.LoadFromMemory(stream); TextAsset[] TA = bundle.LoadAllAssets <TextAsset>(); foreach (TextAsset t in TA) { string luaDecrypt = LuaConst.Decrypt(t.text, "12345678", "56781234"); LuaDict.Add(t.name, System.Text.Encoding.UTF8.GetBytes(luaDecrypt)); } } else { string path = LuaConst.DataPath + "/lua/"; GetAllFiles(new DirectoryInfo(path)); } } XLua.LuaEnv.CustomLoader CL = new XLua.LuaEnv.CustomLoader(GetLuaFiles); Lua.AddLoader(CL); }
public void AddLoader(XLua.LuaEnv.CustomLoader loader) { bool isDeep = LuaDeepProfilerSetting.Instance.isDeepProfiler; if (isDeep) { InitPathDict(); Proxy(CustomLoader); } Proxy(loader); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <XLua.LuaEnv.CustomLoader>(L, 3)) { string _publicKey = LuaAPI.lua_tostring(L, 2); XLua.LuaEnv.CustomLoader _loader = translator.GetDelegate <XLua.LuaEnv.CustomLoader>(L, 3); XLua.SignatureLoader gen_ret = new XLua.SignatureLoader(_publicKey, _loader); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to XLua.SignatureLoader constructor!")); }
public XLua.LuaEnv.CustomLoader __Gen_Delegate_Imp5(object p0) { #if THREAD_SAFE || HOTFIX_ENABLE lock (luaEnv.luaEnvLock) { #endif RealStatePtr L = luaEnv.rawL; int errFunc = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference); ObjectTranslator translator = luaEnv.translator; translator.PushAny(L, p0); PCall(L, 1, 1, errFunc); XLua.LuaEnv.CustomLoader __gen_ret = translator.GetDelegate <XLua.LuaEnv.CustomLoader>(L, errFunc + 1); LuaAPI.lua_settop(L, errFunc - 1); return(__gen_ret); #if THREAD_SAFE || HOTFIX_ENABLE } #endif }
static int _m_AddLoader(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.LuaEnv gen_to_be_invoked = (XLua.LuaEnv)translator.FastGetCSObj(L, 1); { XLua.LuaEnv.CustomLoader _loader = translator.GetDelegate <XLua.LuaEnv.CustomLoader>(L, 2); gen_to_be_invoked.AddLoader(_loader); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void Proxy(XLua.LuaEnv.CustomLoader loader) { }