Self.bin is apparently nil even though its been defined (fixed)

Hello, i am learning how to use self but i am encountering problems

function amongus:create()
	self.dump= {}  <- self.bin gets defined
end

but when i use it later in a code in a different function it turns out to be nil

function amongus:check()
   self.dump[#self.dump+ 1] = pie  <- attempt to get length of a nil value
end

create() gets ran before check() and i even added a repeat until self.bin isnt nil but it just goes on infinitely

-- Have you implemented the default setup for the classic module like this?
-- module.__index = module?
-- setmetatable?

-- Try printing self.Dump
-- Otherwise, heres the default
-- sorry bro i was scripting

local module = {}
module.__index = module

function module:Get()
    print(self.Dump)
end

function module.New()
    local self = setmetatable({}, module)
    self.Dump = {}
    return self
end

return module
1 Like