lua-users home
lua-l archive

Re: Named metatables (type-named data), similar to typedef of structs in C

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2019年10月24日 at 23:19, bil til <flyer31@googlemail.com> wrote:
>
> Hi,
> I think it would be very nice, if the function setmetatable( table,
> metatable) would support also the case, that the 2nd parameter metatable is
> a string.
variables are names:
local timetype = { __tostring = timetostring, __add = addtwotimes }
local starttime = setmetatable ({hour=13, minute=25}, timetype)
local endtime = setmetatable({hout=16, minute=12}, timetype)
-- 
Javier

AltStyle によって変換されたページ (->オリジナル) /