Wed, 30 Sep 2009 11:05:01 +0100
componentmanager: Preserve existing events table (if any) when registering a component
core/componentmanager.lua | file | annotate | diff | comparison | revisions |
--- 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