示例#1
0
        public static int GetClass(IntPtr l)
        {
            int result;

            try
            {
                string text;
                LuaObject.checkType(l, 1, out text);
                Type type = LuaObject.FindType(text);
                if (type == null)
                {
                    result = LuaObject.error(l, "Can't find {0} to create", new object[]
                    {
                        text
                    });
                }
                else
                {
                    LuaClassObject o = new LuaClassObject(type);
                    LuaObject.pushValue(l, true);
                    LuaObject.pushObject(l, o);
                    result = 2;
                }
            }
            catch (Exception e)
            {
                result = LuaObject.error(l, e);
            }
            return(result);
        }
示例#2
0
        static public int GetClass(IntPtr l)
        {
            try
            {
                string cls;
                checkType(l, 1, out cls);
                Type t = LuaObject.FindType(cls);
                if (t == null)
                {
                    return(error(l, "Can't find {0} to create", cls));
                }

                LuaClassObject co = new LuaClassObject(t);
                pushValue(l, true);
                LuaObject.pushObject(l, co);
                return(2);
            }
            catch (Exception e)
            {
                return(error(l, e));
            }
        }