lua-users home
lua-l archive

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


> do
> local smt = debug.getmetatable("")
> function smt.__add(a, b) return tonumber(a) + tonumber(b) end
>   local an = tonumber(a) or error(a.." used in arithmetic is not a number", 2)
>   local bn = tonumber(b) or error(b.." used in arithmetic is not a number", 2)
>   return an + bn
> end
> debug.setmetatable("", smt)
> end
...
> ""Any fool can write code that a computer can understand. 
> Good programmers write code that humans can understand."
> 

True.  Very, very true.

D.