Furthermore, can we access t during love.load?
Obviously we can have a global variable, but that seems like an overkill if I just want to parse some command line arguments at conf.lua stage and pass it onto main.lua
Is it possible to pass custom property from conf.lua to main.lua
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Is it possible to pass custom property from conf.lua to main.lua
The return value from conf.lua (if any) ends up in package.loaded.conf, so you can return something from conf.lua and then require 'conf' in main.lua (or another file) to get that value. You won't be able to return "t," though, for obvious reasons.bitinn wrote:Is it possible to pass custom property from conf.lua to main.lua
You could define love.load inside of love.conf.bitinn wrote:Furthermore, can we access t during love.load?
Code: Select all
function love.conf (t)
t.window.width = 300
t.window.height = 200
function love.load ()
print(t.window.width, t.window.height)
end
end
Re: Is it possible to pass custom property from conf.lua to main.lua
Ah thx, with require('conf') we can do what we want with this:
Code: Select all
-- in conf.lua
local conf = {}
conf.args = args
function love.conf (t)
-- other config
conf.t = t
end
return conf
-- in main.lua
local conf = require('conf')
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 3 guests