summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-02-26 17:07:33 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2015-02-26 17:07:33 +0000
commit72b26fd49bb34f2468f80728476143e67f5b6477 (patch)
treef9bc2cd4fef1a646d1d72dacd9c27f879fcbfd37 /src/bindings
parentb4dee8db54816b7325629a65e94dc75c0ce9ebf0 (diff)
elua: minor eo bindings optimization
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/luajit/eo.lua37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index 09add8b402..37c483f5cd 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -125,27 +125,28 @@ local eo
125local classes = {} 125local classes = {}
126local eo_classes = {} 126local eo_classes = {}
127 127
128local connect = function(self, ename, func)
129 local ev = self.__events[ename]
130 if not ev then
131 error("invalid event '" .. ename .. "'", 2)
132 end
133 local cl = eo_classes["Eo_Base"]
134 M.__do_start(self, cl)
135 eo.eo_event_callback_priority_add(ev, 0,
136 function(data, obj, desc, einfo)
137 return func(obj, einfo) ~= false
138 end,
139 nil)
140 M.__do_end()
141end
142
128local init = function() 143local init = function()
129 eo = util.lib_load("eo") 144 eo = util.lib_load("eo")
130 eo.eo_init() 145 eo.eo_init()
131 local eocl = eo.eo_base_class_get() 146 local eocl = eo.eo_base_class_get()
132 local addr = eo_class_addr_get(eocl) 147 local addr = eo_class_addr_get(eocl)
133 classes["Eo_Base"] = util.Object:clone { 148 classes["Eo_Base"] = util.Object:clone {
134 connect = function(self, ename, func) 149 connect = connect,
135 local ev = self.__events[ename]
136 if not ev then
137 error("invalid event '" .. ename .. "'", 2)
138 end
139 local cl = eo_classes["Eo_Base"]
140 M.__do_start(self, cl)
141 eo.eo_event_callback_priority_add(ev, 0,
142 function(data, obj, desc, einfo)
143 return func(obj, einfo) ~= false
144 end,
145 nil)
146 M.__do_end()
147 end,
148
149 __events = util.Object:clone {}, 150 __events = util.Object:clone {},
150 __properties = util.Object:clone {} 151 __properties = util.Object:clone {}
151 } 152 }
@@ -224,10 +225,8 @@ end
224 225
225M.class_unregister = function(name) 226M.class_unregister = function(name)
226 local addr = eo_class_addr_get(eo_classes[name]) 227 local addr = eo_class_addr_get(eo_classes[name])
227 classes[name] = nil 228 classes [name], classes [addr] = nil
228 classes[addr] = nil 229 eo_classes[name], eo_classes[addr] = nil
229 eo_classes[name] = nil
230 eo_classes[addr] = nil
231end 230end
232 231
233local obj_gccb = function(obj) 232local obj_gccb = function(obj)