attempt to call method 'removeSelf' (a nil value)

i am getting the attempt to call method ‘removeSelf’ (a nil value) error

my code is below

thanks in advice.

[lua]
local response
local o
local item ={}

json = require(“json”)

–response="{“data”:{“data”:[{ “item”:1,“amount”:5,“totalamount”:10,}, { “item”:2,“amount”:15,“totalamount”:110,},]}}"

local t = [[{ “one”:1 , “two”:2, “primes”:[2,3,5,7] } ]]

o = json.decode(t)

item[1]={}
item[1].one = o.one
item[2]={}
item[2].two = o.one

if( o ~= nil ) then
o:removeSelf()
o=nil
end[/lua]

:removeSelf() is for display objects but in your code you have it as a table, so simply remove line 13 :slight_smile:

Hi cristopher,

Thank you for your quick response.
How can i remove to table from memory?

O=nill or o={} is enough?

nil is enough for garbage collection to pick it up the next time it runs.

Thank you so much  :slight_smile:

:removeSelf() is for display objects but in your code you have it as a table, so simply remove line 13 :slight_smile:

Hi cristopher,

Thank you for your quick response.
How can i remove to table from memory?

O=nill or o={} is enough?

nil is enough for garbage collection to pick it up the next time it runs.

Thank you so much  :slight_smile: