I just started a new project and am using OOP this time around since I’ve pretty much only used functional programming to date and have barely messed around with OOP and I’m drawing a blank on how to call a method in a for loop?
I basically have a for loop in a module that assembles (calls all the methods) within the module when the assemble method is used but I don’t know how to call them in a for loop with “:” since it’s in a for loop? This is probably really simple idk why I can’t figure it out lol.
function input:assemble(player)
self.player = player
self.Sword = {{}, .35}
for i,v in pairs(self) do
if v ~= self.assemble and type(v) == "function" then
print(i)
self[i]() --this calls the methods but doesn't pass the "self" argument since I'm not calling the functions as a method.
end
end
end