/// <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)); }
/// <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); }
/// <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); }