function myFunc(a,b,c)
b = b or 10
c = c or -1
print (a,b,c)
end
Since both 'b' and 'c' have defaults, I'm guessing there isn't a way to set 'c', but leave b as default?
Because myFunc(10,20) would set a and b, and leave c as default. Or can you use some type of explicit assignment, like this... myFunc(10,c=20) ?
In this case, nil would be preferred over false because nil represents the absence of a variable, while false could be an argument.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
davisdude wrote: ↑Sat Aug 05, 2017 11:31 pm
In this case, nil would be preferred over false because nil represents the absence of a variable, while false could be an argument.
Yes, but since they're using "or", that doesn't differentiate between them it only cares about whether it's truth-y or false-y.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.