@Staples Shows 2 ways to create the class table. Pass it a table (tab1) or create the table (tab2) in the class.
function setup()
t1={1,2,3,4,5}
t=tab(t1)
print("tab1")
for a,b in pairs(t.tab1) do
print(b)
end
print("tab2")
for a,b in pairs(t.tab2) do
print(b)
end
end
tab=class()
function tab:init(t1)
self.tab1=t1
self.tab2={6,7,8,9}
end
Comments
Self.tbl = {}
@Luatee do you have to put it in the parenthesis in the init function?
EDIT: sorry stupid question!
@Staples Shows 2 ways to create the class table. Pass it a table (tab1) or create the table (tab2) in the class.