I didn't quite understand love's filesystem at first, so this is how I got it to work (I have an Ini "class" for this):
Code: Select all
function Ini:load_file(file) -- receives a "life.ini" string from main.lua
self._file = file
if love.filesystem.getInfo(self._file) then
local f = love.filesystem.read(self._file)
-- this parses the file and stores everything in a table of key/value pairs
self:store_data( f:split('\n') )
else
print("\n\n (ini) ERROR: '".. self._file .. "' does not exist or something.\n\n")
end
end
Code: Select all
[DISPLAY]
use_textures = 0
cellsize_scalar = 2 // for textures use 1 = 16x16 | 2 = 8x8 | 4 = 4x4
backgroundColor = {0, 0, 0, 1}
[MISC]
randomize_at_start = 0
start_paused = 1
screen_wrap = 1 // if true, cells at one end count as neighbors for the ones on the opposite end
That code above requires that life.ini is amidst the lua files, but that's the equivalent of it being inside the .love file or packed into the exe. It works packed into the exe, but then, the file is inaccessible...
I tried adapting the code that's in the docs but I got stuck trying to figure out how to load a file that isn't an image/sound/etc.
Is there a way to do this?