i read some tutorials on simulation classes in lua, but i am not really sure if i got it right...
Code: Select all
public class WallInfo
{
public WallInfo(double d, double d1, double d2, double d3, double d4)
{
top=d2;
bottom=d3;
left=d;
right=d1;
ctop=d2+d4;
cbottom=d3-d4;
cleft=d+d4;
cright=d1-d4;
}
public double top;
public double bottom;
public double left;
public double right;
public double ctop;
public double cbottom;
public double cleft;
public double cright;
}
is the equivalent in lua the following?
Code: Select all
WallInfo={}
WallInfo_mt={}
function WallInfo:new(d, d1, d2, d3, d4)
return setmetatable({top=d2, bottom=d3, left=d, right=d1, ctop=d2+d4, cbottom=d3-d4, cleft=d+d4, cright=d1-d4}, WallInfo_mt)
end
greets
LuMo