blob: b0fbe81269fe21aef91a9fd030c013f976727dcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
local Quantity
local metatable = {
__tostring = function (self)
return ("Quantity{%d, %q}"):format(self.amount, self.material)
end,
}
function Quantity (obj)
return setmetatable({amount=obj.amount or obj[1], material=obj.material or obj[2]}, metatable)
end
return Quantity
|