示例#1
0
        public static int luaL_loadbufferx_replace(IntPtr luaState, IntPtr buff, IntPtr size, string name, IntPtr mode)
        {
            lock (m_Lock)
            {
                if (isHook)
                {
                    if (name == null)
                    {
                        name = "chunk";
                    }
                    byte[] buffer = new byte[(int)size];
                    Marshal.Copy(buff, buffer, 0, buffer.Length);

                    // dostring
                    if (name.Length == (int)size)
                    {
                        name = "chunk";
                    }
                    buffer = LuaHook.Hookloadbuffer(luaState, buffer, name);
                    buff   = NativeUtility.ConvertByteArrayToPtr(buffer);
                    size   = (IntPtr)buffer.Length;
                }
                return(luaL_loadbufferx(luaState, buff, size, name, mode));
            }
        }
示例#2
0
        public static int luaL_loadbufferUnHook(IntPtr luaState, byte[] buff, IntPtr size, string name)
        {
            if (luaL_loadbuffer_hook != null)
            {
                UnInstallHook(luaL_loadbuffer_hook);
            }
            IntPtr intPtr = NativeUtility.ConvertByteArrayToPtr(buff);
            int    result = luaL_loadbufferx(luaState, intPtr, size, name, IntPtr.Zero);

            if (luaL_loadbuffer_hook != null)
            {
                InstallHook(luaL_loadbuffer_hook);
            }
            return(result);
        }