I am very confused about some of the documentation which lists more that one version of a function. To my knowledge, Lua functions can be variadic, but there is only one version of each.
For example, the documentation for love.graphics.newFont (https://love2d.org/wiki/love.graphics.newFont), lists 4 different versions. How do I determine which one my code will use?
Documentation lists multiple versions of the same function
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Documentation lists multiple versions of the same function
There is only one function, but what that function does depends on the number and the types of the call arguments.
See also: https://en.wikipedia.org/wiki/Function_overloading
Code: Select all
love.graphics.newFont('myfont.ttf') -- create font with default size and options
love.graphics.newFont('myfont.ttf', 32) -- create font at size 32 with default options
love.graphics.newFont('myfont.fnt', 'myfont.png') -- create ImageFont from these files
-- etc.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Documentation lists multiple versions of the same function
Either that, or the function was changed across versions and you set the version selector to show all versions.
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 5 guests