Difference between revisions of "Config Files"

(love.conf)
(Trying to make the 0.8.0 information a bit more structured)
Line 23: Line 23:
 
Setting unused modules to false is encouraged when you release your game. It reduces startup time (slightly) and reduces memory usage (slightly).
 
Setting unused modules to false is encouraged when you release your game. It reduces startup time (slightly) and reduces memory usage (slightly).
  
Here is a full list of options and their default values:
+
Here is a full list of options and their default values for LÖVE 0.7.2 and earlier:
 
<source lang="lua">  
 
<source lang="lua">  
 
function love.conf(t)
 
function love.conf(t)
Line 29: Line 29:
 
     t.author = "Unnamed"        -- The author of the game (string)
 
     t.author = "Unnamed"        -- The author of the game (string)
 
     t.identity = nil            -- The name of the save directory (string)
 
     t.identity = nil            -- The name of the save directory (string)
     t.version = "0.7.2"        -- The LÖVE version this game was made for (string)
+
     t.version = 0               -- The LÖVE version this game was made for (number)
 
     t.console = false          -- Attach a console (boolean, Windows only)
 
     t.console = false          -- Attach a console (boolean, Windows only)
    t.release = false          -- Enable release mode (boolean)
 
 
     t.screen.width = 800        -- The window width (number)
 
     t.screen.width = 800        -- The window width (number)
 
     t.screen.height = 600      -- The window height (number)
 
     t.screen.height = 600      -- The window height (number)
Line 52: Line 51:
 
Note that you can't disable [[love.filesystem]]; it's mandatory. The same goes for the [[love]] module itself.
 
Note that you can't disable [[love.filesystem]]; it's mandatory. The same goes for the [[love]] module itself.
  
t.version should be a string representing the version of LÖVE for which your game was made. It should be formatted as "''X.Y.Z''" where ''X'' is the major release number, ''Y'' the minor, and ''Z'' the patch level. It is meant for compatibility suggestion and has no effect when running LÖVE versions below [[0.8.0]].
+
=== Changes in 0.8.0 ===
 +
 
 +
LÖVE 0.8.0 will bring some changes to the configuration file. The default values are:
 +
<source lang="lua">
 +
function love.conf(t)
 +
    t.title = "Untitled"        -- The title of the window the game is in (string)
 +
    t.author = "Unnamed"        -- The author of the game (string)
 +
    t.identity = nil            -- The name of the save directory (string)
 +
    t.version = "0.8.0"        -- The LÖVE version this game was made for (string)
 +
    t.console = false          -- Attach a console (boolean, Windows only)
 +
    t.release = false          -- Enable release mode (boolean)
 +
    t.screen.width = 800        -- The window width (number)
 +
    t.screen.height = 600      -- The window height (number)
 +
    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.modules.joystick = true  -- Enable the joystick module (boolean)
 +
    t.modules.audio = true      -- Enable the audio module (boolean)
 +
    t.modules.keyboard = true  -- Enable the keyboard module (boolean)
 +
    t.modules.event = true      -- Enable the event module (boolean)
 +
    t.modules.image = true      -- Enable the image module (boolean)
 +
    t.modules.graphics = true  -- Enable the graphics module (boolean)
 +
    t.modules.timer = true      -- Enable the timer module (boolean)
 +
    t.modules.mouse = true      -- Enable the mouse module (boolean)
 +
    t.modules.sound = true      -- Enable the sound module (boolean)
 +
    t.modules.physics = true    -- Enable the physics module (boolean)
 +
end
 +
</source>
 +
 
 +
==== Version ====
 +
{{newin|0.8.0|080|type=flag}}
 +
<code>t.version</code> should be a string, representing the version of LÖVE for which your game was made. It should be formatted as <code>"''X.Y.Z''"</code> where <code>''X''</code> is the major release number, <code>''Y''</code> the minor, and <code>''Z''</code> the patch level. It allows LÖVE to display a warning if it isn't compatible. Its default is the version of LÖVE running.
  
=== Release Mode ===
+
==== Release Mode ====
{{newin|0.8.0}}
+
{{newin|0.8.0|080|type=flag}}
Uses the release error handler (love.releaseerrhand), which is sparse on information by default, and can, of course, be overridden.
+
0.8.0 adds a new flag: <code>t.release</code>. When enabled, LÖVE uses the release error handler (love.releaseerrhand), which is sparse on information by default, and can, of course, be overridden.
  
 
When a fused game in release mode is run it will not save in the love save dir, but rather one for itself, whereas previously it would be %APPDATA%\\LOVE\\game on windows, it now is %APPDATA%\\game. (Note that this holds true for all platforms.)
 
When a fused game in release mode is run it will not save in the love save dir, but rather one for itself, whereas previously it would be %APPDATA%\\LOVE\\game on windows, it now is %APPDATA%\\game. (Note that this holds true for all platforms.)

Revision as of 01:43, 6 November 2011

Introduction

If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE 'boot' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff.

love.conf

The love.conf function takes one argument: a table filled with all the default values which you can overwrite to your liking. If you want to change the default screen size, for instance, do:

function love.conf(t)
    t.screen.width = 1024
    t.screen.height = 768
end

If you don't need the physics module or joystick module, do the following.

function love.conf(t)
    t.modules.joystick = false
    t.modules.physics = false
end

Setting unused modules to false is encouraged when you release your game. It reduces startup time (slightly) and reduces memory usage (slightly).

Here is a full list of options and their default values for LÖVE 0.7.2 and earlier:

 
function love.conf(t)
    t.title = "Untitled"        -- The title of the window the game is in (string)
    t.author = "Unnamed"        -- The author of the game (string)
    t.identity = nil            -- The name of the save directory (string)
    t.version = 0               -- The LÖVE version this game was made for (number)
    t.console = false           -- Attach a console (boolean, Windows only)
    t.screen.width = 800        -- The window width (number)
    t.screen.height = 600       -- The window height (number)
    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.modules.joystick = true   -- Enable the joystick module (boolean)
    t.modules.audio = true      -- Enable the audio module (boolean)
    t.modules.keyboard = true   -- Enable the keyboard module (boolean)
    t.modules.event = true      -- Enable the event module (boolean)
    t.modules.image = true      -- Enable the image module (boolean)
    t.modules.graphics = true   -- Enable the graphics module (boolean)
    t.modules.timer = true      -- Enable the timer module (boolean)
    t.modules.mouse = true      -- Enable the mouse module (boolean)
    t.modules.sound = true      -- Enable the sound module (boolean)
    t.modules.physics = true    -- Enable the physics module (boolean)
end

Note that you can't disable love.filesystem; it's mandatory. The same goes for the love module itself.

Changes in 0.8.0

LÖVE 0.8.0 will bring some changes to the configuration file. The default values are:

 
function love.conf(t)
    t.title = "Untitled"        -- The title of the window the game is in (string)
    t.author = "Unnamed"        -- The author of the game (string)
    t.identity = nil            -- The name of the save directory (string)
    t.version = "0.8.0"         -- The LÖVE version this game was made for (string)
    t.console = false           -- Attach a console (boolean, Windows only)
    t.release = false           -- Enable release mode (boolean)
    t.screen.width = 800        -- The window width (number)
    t.screen.height = 600       -- The window height (number)
    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.modules.joystick = true   -- Enable the joystick module (boolean)
    t.modules.audio = true      -- Enable the audio module (boolean)
    t.modules.keyboard = true   -- Enable the keyboard module (boolean)
    t.modules.event = true      -- Enable the event module (boolean)
    t.modules.image = true      -- Enable the image module (boolean)
    t.modules.graphics = true   -- Enable the graphics module (boolean)
    t.modules.timer = true      -- Enable the timer module (boolean)
    t.modules.mouse = true      -- Enable the mouse module (boolean)
    t.modules.sound = true      -- Enable the sound module (boolean)
    t.modules.physics = true    -- Enable the physics module (boolean)
end

Version

Available since LÖVE 0.8.0
This flag is not supported in earlier versions.

t.version should be a string, representing the version of LÖVE for which your game was made. It should be formatted as "X.Y.Z" where X is the major release number, Y the minor, and Z the patch level. It allows LÖVE to display a warning if it isn't compatible. Its default is the version of LÖVE running.

Release Mode

Available since LÖVE 0.8.0
This flag is not supported in earlier versions.

0.8.0 adds a new flag: t.release. When enabled, LÖVE uses the release error handler (love.releaseerrhand), which is sparse on information by default, and can, of course, be overridden.

When a fused game in release mode is run it will not save in the love save dir, but rather one for itself, whereas previously it would be %APPDATA%\\LOVE\\game on windows, it now is %APPDATA%\\game. (Note that this holds true for all platforms.)

Other Languages