You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have problem with private table in lib.class, acctualy when I call method from the same method, the private table returns null.
To Reproduce
I wrote simple code to reproduce this.
local Inventory = lib.class('Inventory')
function Inventory:constructor()
self.private.items = { { name = 'bread', count = 1 }, { name = 'water', count = 2 } }
end
function Inventory:getItem(rec)
print(json.encode(self.private.items))
rec = rec or 0
if rec == 1 then return end
rec += 1
return self:getItem(rec)
end
local playerInventory = Inventory:new()
playerInventory:getItem()
--[[
returns:
--> [{"count":1,"name":"bread"},{"count":2,"name":"water"}]
--> null
]]
Expected behavior
I expected the private table return its data.
The text was updated successfully, but these errors were encountered:
Describe the bug
I have problem with private table in lib.class, acctualy when I call method from the same method, the private table returns null.
To Reproduce
I wrote simple code to reproduce this.
Expected behavior
I expected the private table return its data.
The text was updated successfully, but these errors were encountered: