|
|
||
|
function unm_event (op)
local o = tonumber(op)
if o then -- operand is numeric?
return -o -- `-' here is the primitive `unm'
else -- the operand is not numeric.
-- Try to get a handler from the operand
local h = metatable(op).__unm
if h then
-- call the handler with the operand
return h(op)
else -- no handler available: default behavior
error("...")
end
end
end
"h(op)" should result in just one argument on the stack. I am using Lua 5.1.2. What is wrong?
Greets, Ronald