Ejemplo n.º 1
0
        public LuaReflection()
        {
#if !MULTI_STATE
            _reflection = this;
#endif
            LoadAssembly("mscorlib");
            //LoadAssembly("UnityEngine");
            //注释避免放在插件目录无法加载,需要可从lua代码loadassembly
            //LoadAssembly("Assembly-CSharp");
        }
Ejemplo n.º 2
0
        static int LoadAssembly(IntPtr L)
        {
            try
            {
                LuaReflection reflection = LuaReflection.Get(L);
                string        name       = ToLua.CheckString(L, 1);
                LuaDLL.lua_pushboolean(L, reflection.LoadAssembly(name));
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(1);
        }
Ejemplo n.º 3
0
        static int FindType(IntPtr L)
        {
            string          name       = ToLua.CheckString(L, 1);
            LuaReflection   reflection = LuaReflection.Get(L);
            List <Assembly> list       = reflection.list;
            Type            t          = null;

            for (int i = 0; i < list.Count; i++)
            {
                t = list[i].GetType(name);

                if (t != null)
                {
                    break;
                }
            }

            ToLua.Push(L, t);
            return(1);
        }