Content deleted Content added
|
|
yesno('foo')
yesno({})
yesno(5)gghjghjghhvvjbbbbbbbbbbbbbbbbbbbbbjjjvyyyyyyyyyvghvghv'f;wf-fefw;f';s.f;as.fd//.3ed
yesno(5)
rns true.
yesno(function() return 'This is a function.' end)
-- These return true:
yesno('foo', true)
yesno({}, true)
yesno(5, true)
yesno(function() return 'This is a function.' end, true)
-- These return "bar":
yesno('foo', 'bar')
yesno({}, 'bar')
yesno(5, 'bar')
yesno(function() return 'This is a function.' end, 'bar')
</syntaxhighlight>
Note that the blank string also functions this way:
<syntaxhighlight lang="lua">
yesno('') -- Returns nil.
yesno('', true) -- Returns true.
yesno('', 'bar') -- Returns "bar".
</syntaxhighlight>
|