From 3131f2d1589755fbbc7c9a189d24c0a27e062831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Garc=C3=ADa?= Date: Thu, 27 Oct 2011 00:27:21 +0200 Subject: [PATCH] refactor --- beholder.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beholder.lua b/beholder.lua index 364e66f..a8aa947 100644 --- a/beholder.lua +++ b/beholder.lua @@ -19,7 +19,7 @@ local function findNodeById(self, id) end local function createNode(self, event) - self._nodes[event] = {} + self._nodes[event] = {actions = {}} return self._nodes[event] end @@ -29,13 +29,13 @@ end local function registerActionInNode(self, node, action) local id = {} - node[id] = action + node.actions[id] = action self._ids[id] = node return id end local function unregisterActionFromNode(self, node, id) - node[id] = nil + node.actions[id] = nil self._ids[id] = nil end @@ -54,7 +54,7 @@ end function beholder:trigger(event,...) local node = findNode(self, event) or {} - for _,action in pairs(node) do + for _,action in pairs(node.actions) do action(...) end end