I had a search on the forums but turned up a lot of information about other things to do with conf.lua.
cheers

Code: Select all
-- conf.lua
S_WIDTH, S_HEIGHT = 800, 600
S_TITLE = "Test Window"
function love.conf(ct)
ct.screen.width, ct.screen.height = S_WIDTH, S_HEIGHT
ct.title = S_TITLE
end
Code: Select all
-- main.lua
local w, h, title
function love.load()
w, h, title = S_WIDTH, S_HEIGHT, S_TITLE
end
Code: Select all
function love.conf(t)
t.title = "mouse drag image" -- The title of game window (string)
t.author = "Ref" -- The author of the game (string)
t.screen.fullscreen = false -- Enable fullscreen (boolean)
t.screen.vsync = true -- Enable vertical sync (boolean)
t.screen.fsaa = 0 -- The number of FSAA-buffers (number)
t.screen.height = 512 -- The window height (number)
t.screen.width = 512 -- The window width (number)
t.version = "0.8.0" -- The LOVE version (string)
t.console = false -- Enable console (boolean)
end
Code: Select all
local temp = {}
temp.screen = {}
love.conf( temp)
title = temp.title
width = temp.screen.width
height = temp.screen.height
...
Code: Select all
configTable = {} -- use any variable name
function love.conf(t)
t.screen.width = 800
t.screen.height = 600
t.title = "Test Window"
configTable = t
end
Code: Select all
function love.load()
local screenWidth = configTable.screen.width -- access all of the values inside the table
end
That basically has the same spirit as Ref's snippet, though.Anickyan wrote:Actually, this would be the easiest, I think
Yeah... But for a Lua beginner, t might be easier to understand ó_óRoland_Yonaba wrote: That basically has the same spirit as Ref's snippet, though.
Users browsing this forum: Google [Bot] and 7 guests