Page 1 of 1

[Solved] How to get Display Index

Posted: Mon Jan 18, 2021 6:04 pm
by GVovkiv
So, i need to get display index as argument for function
For example:

Code: Select all

love.graphics.print(*displayindex*, 0, 0)
I know there exist love.window.getMode() function, but i don't know how to get "display" from that table directly
Thanks

Re: How to get Display Index

Posted: Mon Jan 18, 2021 8:52 pm
by pgimeno
It's basic table indexing.

Code: Select all

love.graphics.print(select(3, love.window.getMode()).display)
The select() is there just for accessing the third element directly. This works too:

Code: Select all

local w, h, flags = love.window.getMode()
love.graphics.print(flags.display)

Re: How to get Display Index

Posted: Mon Jan 18, 2021 9:02 pm
by GVovkiv
pgimeno wrote: Mon Jan 18, 2021 8:52 pm It's basic table indexing.

Code: Select all

love.graphics.print(select(3, love.window.getMode()).display)
The select() is there just for accessing the third element directly. This works too:

Code: Select all

local w, h, flags = love.window.getMode()
love.graphics.print(flags.display)
Thank you!