Hi Martin
Thanks for your reply.
So a return type of 'void|object' means this function may return either an
object or nothing at all.  But if it returns nothing there won't be an
error, because the missing value is converted to 0?  Whereas if the return
type were just 'object' and you returned nothing, the compiler would
complain?  Hope I've got that right, because that does make a lot more sense
:)

Though in that case, surely there's no point to SDL.get_video_info()
returning type 'void|object', because there's never going to be a scenario
where it doesn't return anything.  It's always going to return either an
object or 0, both of which you can assign to an object and which you'd test
in exactly the same way:

if ( object o = SDL.get_video_info() )
{
    // success
}

Best wishes, larcky.


-- 
View this message in context: 
http://old.nabble.com/SDL.get_video_info%28%29-docs-tp30799952p30808166.html
Sent from the Pike - Dev mailing list archive at Nabble.com.

  • SDL... Matthew Clarke
    • ... Martin Bähr
      • ... larcky
        • ... Martin Baehr
          • ... larcky
            • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum

Reply via email to