How to use values from conf.lua?

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
BoopDeePoop
Prole
Posts: 39
Joined: Sun Dec 30, 2012 4:15 am

How to use values from conf.lua?

Post by BoopDeePoop »

I'm trying to check whether or not vsync is enabled and I get this error: "attempt to index global 't' (a nil value)

Code: Select all

	if t.window.vsync == true then
		love.graphics.print("vSync: Enabled",0,20)
	elseif t.window.vsync == false then
		love.graphics.print("vSync: Disabled",0,20)
	end
I'm probably doing something really stupid.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: How to use values from conf.lua?

Post by Zilarrezko »

I do know that "t" is actually just a local table in the conf function so I know that you can't access it by t.windows.vsync. That's why you're getting that error. If we found the table that the conf function passes on startup then I'm sure you could access it.

Other than that I can say that you could use the love.graphics.setMode() function in the love.load to set the vsync to false and from there store a variable somewhere that vsync is false. And just create a function so that everytime it's called it toggles vsync and changes the vsync to the opposite boolean value for displaying purposes.

Sorry I can't help ya more. But the big wigs know more about LÖVE's functions and structure than little young me here. Good Luck man.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How to use values from conf.lua?

Post by Robin »

[wiki]love.window.getMode[/wiki]

Code: Select all

	local width, height, flags = love.window.getMode( )
	if flags.vsync then
		love.graphics.print("vSync: Enabled",0,20)
	else
		love.graphics.print("vSync: Disabled",0,20)
	end
or even:

Code: Select all

	local width, height, flags = love.window.getMode( )
	love.graphics.print(flags.vsync and "vSync: Enabled" or "vSync: Disabled",0,20)
Help us help you: attach a .love.
Post Reply

Who is online

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