summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-09-24 13:37:26 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-09-24 13:37:26 +0100
commit85a135d32e26b29c842a37bb581ae0a7d0ab6d8a (patch)
tree96b21ea9b4152ae2f1b6b51273d0b0cb89683e09
parent0061d5a43747af20755b806a4f150dee68a9a0d3 (diff)
elua: remove the eo_methods stuff, improve class registration
-rw-r--r--src/bindings/luajit/eo.lua15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index e72db2a64e..a74bee43d8 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -137,11 +137,8 @@ M.class_get = function(name)
137 return classes[name] 137 return classes[name]
138end 138end
139 139
140M.class_register = function(name, val, addr) 140M.class_register = function(name, val)
141 classes[name] = val 141 classes[name] = val
142 if addr then
143 classes[tonumber(ffi.cast("intptr_t", addr))] = val
144 end
145 return val 142 return val
146end 143end
147 144
@@ -181,24 +178,20 @@ M.__do_end = function()
181 -- only for cleanup (dtor) 178 -- only for cleanup (dtor)
182end 179end
183 180
184local eo_methods = {
185}
186
187ffi.metatype("Eo", { 181ffi.metatype("Eo", {
188 __index = function(self, key) 182 __index = function(self, key)
189 local v = rawget(eo_methods, key)
190 if v ~= nil then return v end
191 local cl = eo.eo_class_get(self) 183 local cl = eo.eo_class_get(self)
192 if cl == nil then return nil end 184 if cl == nil then return nil end
193 local nm = eo.eo_class_name_get(cl) 185 local nm = eo.eo_class_name_get(cl)
194 if nm == nil then return nil end 186 if nm == nil then return nil end
195 local mt == classes[nm] 187 local mt == classes[ffi.string(nm)]
196 if mt == nil then return nil end 188 if mt == nil then return nil end
197 return mt[key] 189 return mt[key]
198 end 190 end
199}) 191})
200 192
201M.Eo_Base = util.Object:clone { 193M.Base = util.Object:clone {
202} 194}
195M.class_register("Eo.Base", M.Base)
203 196
204return M 197return M