LuaInterface.LuaStatic.GetPreModule C# (CSharp) Method

GetPreModule() public static method

public static GetPreModule ( IntPtr L, Type t ) : LuaCSFunction
L System.IntPtr
t System.Type
return LuaCSFunction
        public static LuaCSFunction GetPreModule(IntPtr L, Type t)
        {
            LuaState state = LuaState.Get(L);
            return state.GetPreModule(t);
        }

Usage Example

示例#1
0
        public static void PushValue(IntPtr L, ValueType v)
        {
            if (v == null)
            {
                LuaDLL.lua_pushnil(L);
                return;
            }
            Type             type             = v.GetType();
            int              metaReference    = LuaStatic.GetMetaReference(L, type);
            ObjectTranslator objectTranslator = ObjectTranslator.Get(L);

            if (metaReference > 0)
            {
                int index = objectTranslator.AddObject(v);
                LuaDLL.tolua_pushnewudata(L, metaReference, index);
            }
            else
            {
                LuaCSFunction preModule = LuaStatic.GetPreModule(L, type);
                if (preModule != null)
                {
                    preModule(L);
                    metaReference = LuaStatic.GetMetaReference(L, type);
                    if (metaReference > 0)
                    {
                        int index2 = objectTranslator.AddObject(v);
                        LuaDLL.tolua_pushnewudata(L, metaReference, index2);
                        return;
                    }
                }
                LuaDLL.lua_pushnil(L);
                Debugger.LogError("Type {0} not wrap to lua", LuaMisc.GetTypeName(type));
            }
        }
All Usage Examples Of LuaInterface.LuaStatic::GetPreModule