Skip to content
ConcordConcordConcord

Utils

Helper module for misc operations

If the concord folder is in the root directory of your game, you can import this module like so:

Utils = require('concord.utils')

Raises a formatted error.

Utils.error( level, str, ... )
Name Type Description
level integer Error level passed to error(), plus one
str string Format string
... any Format arguments

Copies keys from orig into target. Existing keys in target are overwritten.

matches = Utils.shallowCopy( orig, target )
Name Type Description
orig table Table to copy from
target table Table to copy into
Name Type Description
matches table target

Requires files and stores them in a namespace table.

Accepts a table of require paths: {“path/to/file_1”, “path/to/another/file_2”, “etc”} Accepts a path to a directory of Lua files: “my_files/here” Directory loading uses love.filesystem and requires LÖVE. If namespace is omitted, files are still required and this function returns nil.

Utils.loadNamespace( pathOrFiles, namespace )
Name Type Description
pathOrFiles string|table A directory path or a table of require paths
namespace table Table that will hold the required files
Name Type Description
table|nil namespace The namespace table