love.maker

This library was written in Lua specifically for the LÖVE framework. love.maker is a library that can minify, compile and compress your project folder. If you choose to compile your Lua script files, the resulting .love file will only run on the exact same version of LÖVE or LuaJIT that was used when building. This library allows you to output .love files anywhere on your system using absolute paths.
The source code is available on GitHub and the official documentation is on 2dengine.com

Example

love.maker = require("maker")
love.maker.setExtensions('lua', 'png', 'txt') -- include only the specified extensions
local build = love.maker.newBuild("C://path/to/project/folder/") -- create from source folder build:ignore('/readme.txt') -- exclude a specific file build:ignoreMatch('^/%.git') -- exclude based on pattern matching build:allow('/images/exception.jpg') -- whitelist a specific file
build:save('C://path/to/output/game.love', 'DEMO') -- build the .love project file local comment = love.maker.getComment(dest) print(comment)

Credits

Source code by 2dengine LLC (MIT License)
Compression by Rami Sabbagh (MIT License)
Minification by Marcus 'ReFreezed' Thunström (MIT License)
Un-Restricted File System by Ross Grams (MIT License)
Testing by gphg and the LÖVE community
Please support our work so we can release more free software in the future.

love.maker > maker

maker

The "maker" module is used to create .love files or read comments from existing .love files.
maker.getComment(path)
maker.newBuild(gamepath)
maker.setExtensions(...)

maker.getComment(path)

Returns the comment written to an existing .love file (ZIP file comment).
Arguments
stringpath
Absolute path to some .love file
Returns
string Previously saved comment or nil

maker.newBuild(gamepath)

Creates a new build from a specified project directory.
Arguments
stringgamepath
Absolute path to your project
Returns
build New build object

maker.setExtensions(...)

Sets the file extensions to be included in the .love file.
Arguments
arguments...
List of file extensions

love.maker > build

build

The "build" object is used to customize what is included or excluded in the generated .love file.
build:allow(path)
build:ignore(path)
build:ignoreMatch(pattern)
build:isAllowed(path)
build:recursive(prefix, path, func)
build:save(dest, comment, mode)
build:scan()
build:write(path, content)

build:allow(path)

Marks a specific file for inclusion.
Arguments
stringpath
Relative path

build:ignore(path)

Marks a specific path for exclusion.
Arguments
stringpath
Relative path

build:ignoreMatch(pattern)

Marks paths for exclusion based on pattern matching.
Arguments
stringpattern
Pattern matching expression

build:isAllowed(path)

Checks if the file path is included.
Arguments
stringpath
Relative file path
Returns
boolean True if the file will be included

build:recursive(prefix, path, func)

This is an internal function.
Arguments
stringprefix
Path prefix
stringpath
Relative path
functionfunc
Callback function

build:save(dest, comment, mode)

Packages the project into a .love file. The "mode" argument is used to optionally minify or compile the included .lua files. Empty directories are not included in the generated .love file.
Arguments
stringdest
Absolute path where the generated .love file is saved
stringcomment (optional)
String comment appended to the .love file
stringmode (optional)
Processing mode: "none", "minify" or "dump"
Returns
boolean True if the .love file was saved successfully
number Number of bytes written or an error message

build:scan()

This is an internal function.

build:write(path, content)

Adds a file to the build from string contents. Replaces any files within the build located in the same path.
Arguments
stringpath
File path
stringcontent
File contents

This document was last updated on October 09, 2024, by 2dengine LLC. © All rights reserved.