# HG changeset patch # User Matthew Wild # Date 1254305101 -3600 # Node ID 0a4d4ba01db806f1df72ba1b16ed2e25e83efbc4 # Parent 8f1871c1d456f99dcf383ba392cbac3ef46132c2 componentmanager: Preserve existing events table (if any) when registering a component diff -r 8f1871c1d456 -r 0a4d4ba01db8 core/componentmanager.lua --- a/core/componentmanager.lua Wed Sep 30 11:03:11 2009 +0100 +++ b/core/componentmanager.lua Wed Sep 30 11:05:01 2009 +0100 @@ -83,9 +83,9 @@ end end -function create_component(host, component) +function create_component(host, component, events) -- TODO check for host well-formedness - return { type = "component", host = host, connected = true, s2sout = {}, events = events_new() }; + return { type = "component", host = host, connected = true, s2sout = {}, events = events or events_new() }; end function register_component(host, component, session) @@ -93,7 +93,7 @@ local old_events = hosts[host] and hosts[host].events; components[host] = component; - hosts[host] = session or create_component(host, component); + hosts[host] = session or create_component(host, component, old_events); -- Add events object if not already one if not hosts[host].events then