I'm new to Lua, but not to coding. Most of my coding has been in C++. I really confused about the syntax around creating and instantiating objects. The code below is working, but how do I create a new object with a different table and a different x and y?
Code:
pad={
x=63,
y=63,
w=9,
h=1,
clr=143,
pad_pxl={{-4,0},{-3,0},{-2,0},{-1,0},{0,0},{1,0},{2,0},{3,0},{4,0}},
state=0,
stbl={-3,-2,-1,0,1,2,3},
rtm=time(),
rst=true,
ptm=0,
dla=1,
new=function(self,tbl)
tbl=tbl or {}
setmetatable(tbl,{
__index=self
})
return tbl
end,
update=function(self)
--etc.
,
draw=function(self)
--etc.
end
}