lua-users home
lua-l archive

:? syntactical sugar request

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


In Lua, if you want to send a message to an object, but only if that method exists you can do:
if object.message then
 object:message()
end
The equivalent in NewtonScript is:
object:?message()
I was thinking if lua had a hook for a ? look whose default behavior was the same as a "." lookup but could be overridden, this syntax would be easy to implement in lua...
Steve

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