(RealStatePtr L)
| 772 | #endif |
| 773 | |
| 774 | [MonoPInvokeCallback(typeof(LuaCSFunction))] |
| 775 | internal static int LoadFromCustomLoaders(RealStatePtr L) |
| 776 | { |
| 777 | try |
| 778 | { |
| 779 | string filename = LuaAPI.lua_tostring(L, 1); |
| 780 | |
| 781 | LuaEnv self = ObjectTranslatorPool.Instance.Find(L).luaEnv; |
| 782 | |
| 783 | foreach (var loader in self.customLoaders) |
| 784 | { |
| 785 | string real_file_path = filename; |
| 786 | byte[] bytes = loader(ref real_file_path); |
| 787 | if (bytes != null) |
| 788 | { |
| 789 | if (LuaAPI.xluaL_loadbuffer(L, bytes, bytes.Length, "@" + real_file_path) != 0) |
| 790 | { |
| 791 | return LuaAPI.luaL_error(L, String.Format("error loading module {0} from CustomLoader, {1}", |
| 792 | LuaAPI.lua_tostring(L, 1), LuaAPI.lua_tostring(L, -1))); |
| 793 | } |
| 794 | return 1; |
| 795 | } |
| 796 | } |
| 797 | LuaAPI.lua_pushstring(L, string.Format( |
| 798 | "\n\tno such file '{0}' in CustomLoaders!", filename)); |
| 799 | return 1; |
| 800 | } |
| 801 | catch (System.Exception e) |
| 802 | { |
| 803 | return LuaAPI.luaL_error(L, "c# exception in LoadFromCustomLoaders:" + e); |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | [MonoPInvokeCallback(typeof(LuaCSFunction))] |
| 808 | public static int LoadAssembly(RealStatePtr L) |
nothing calls this directly
no test coverage detected