[Solved] How to get Display Index

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
GVovkiv
Prole
Posts: 10
Joined: Fri Jan 15, 2021 7:29 am

[Solved] How to get Display Index

Post by GVovkiv » Mon Jan 18, 2021 6:04 pm

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
Last edited by GVovkiv on Sat Jan 23, 2021 1:29 pm, edited 1 time in total.

User avatar
pgimeno
Party member
Posts: 2483
Joined: Sun Oct 18, 2015 2:58 pm

Re: How to get Display Index

Post by pgimeno » 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)

User avatar
GVovkiv
Prole
Posts: 10
Joined: Fri Jan 15, 2021 7:29 am

Re: How to get Display Index

Post by GVovkiv » Mon Jan 18, 2021 9:02 pm

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!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 50 guests