|
|
||
|
Mark Gossage wrote:
function printargs(...) table.foreach({...},print) end
clss={}
mt={__unm=printargs}
setmetatable(clss,mt)
a=-clss
It reports that there are in fact two arguments (the table
repeated twice).
Is the manual wrong, or is there a bug in the code?
It looks like this happens because the function Arith in lvm.c doesn't have a special case for the one unary arithmetical operator. This of course is not a problem unless you write a unary minus metamethod that looks for a second argument, which you probably shouldn't do. The Lua team can answer whether they consider this a bug (in the manual or the implementation). -- Aaron http://arundelo.com/