elua: generate separate key/value numbers for getters/setters
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 28 May 2015 14:41:30 +0000 (15:41 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 28 May 2015 14:41:30 +0000 (15:41 +0100)
src/scripts/elua/modules/lualian.lua

index 9ef3b7b..3689939 100644 (file)
@@ -332,18 +332,22 @@ local Property = Method:clone {
     generate_prop = function(self, props)
         local proto = self:gen_proto()
         local prop = props[proto.name]
-        if prop then
-            if self.isget then
-                prop[3] = "true"
-            else
-                prop[4] = "true"
-            end
-            return false
+        local hasprop = true
+        if not prop then
+            prop = { 0, 0, 0, 0, "false", "false" }
+            props[proto.name] = prop
+            hasprop = false
+        end
+        if self.isget then
+            prop[1] = proto.nkeys
+            prop[3] = math.max(proto.nvals, 1)
+            prop[5] = "true"
         else
-            props[proto.name] = { proto.nkeys, math.max(proto.nvals, 1),
-                tostring(self.isget), tostring(not self.isget) }
-            return true
+            prop[2] = proto.nkeys
+            prop[4] = math.max(proto.nvals, 1)
+            prop[6] = "true"
         end
+        return not hasprop
     end
 }