예제 #1
0
 /// <summary>
 /// Find the proxy for a lua writer
 /// </summary>
 public static LuaWriterProxy FindProxy(Lua.lua_Writer writer)
 {
     if (writer == null)
     {
         return(null);
     }
     return(_Proxies.FirstOrDefault(p => p.UnmanagedWriter == writer));
 }
예제 #2
0
        /// <summary>
        /// Convert a lua writer to writer
        /// </summary>
        public static LuaWriter ToWriter(this Lua.lua_Writer writer)
        {
            if (writer == null)
            {
                return(null);
            }
            var proxy = LuaWriterProxy.GetProxy(writer);

            return(proxy != null ? proxy.ManagedWriter : null);
        }
예제 #3
0
        /// <summary>
        /// Find or create a proxy for a lua writer
        /// </summary>
        public static LuaWriterProxy GetProxy(Lua.lua_Writer writer)
        {
            if (writer == null)
            {
                return(null);
            }
            var result = FindProxy(writer);

            if (result == null)
            {
                result = new LuaWriterProxy()
                {
                    UnmanagedWriter = writer
                };
                result.ManagedWriter = result.InvokeUnmanagedWriter;
                _Proxies.Add(result);
            }
            return(result);
        }