Configure dmc_corona.cfg

Get the most from the dmc_corona.cfg file.

Table of Contents

{toc:style=disc|indent=20px|minLevel=2|exclude=Table of Contents|printable=false}

General Setup

Here are some files which are important to the library:

File: dmc_corona_boot.lua

Boot-File-Location
The boot file is required and needs to be at the root-level of the project.

The dmc_corona_boot.lua is a required file, even if you decide not to use dmc_corona.cfg. The boot file will 1. create the initial global data structure used by the library, 2. read in the config file if it is used, 3. modify module lookup as required.

File: dmc_corona.cfg

Config-File-Location
If the config file is used, it needs to be at the root-level of the project.

The dmc_corona.cfg is a global config file available to all of the modules in the library. It is here that you can specify the location of the files in the DMC Corona Library or modify the behavior of a specific module.

Use of the config file isn't required, however it is strongly recommended.

You only need to use the config file if:

  1. you want to change any default config properties for a module
  2. you want to move the files to another place in your project besides the root-level

Module Access

The setting for the the config LUA_PATH will determine how to access the modules inside of your code.

Default-Location-for-DMC-Corona-Library
By default, the included config file is set for all library files to be inside of a folder named dmc_corona and that folder to be at the root-level.

For example, using the default setup location:

dmc_corona.cfg

[DMC_CORONA]
LUA_PATH:JSON = [ "./dmc_corona" ]

means that you would import modules like this:

local Websockets = require 'dmc_corona.dmc_websockets'
local Objects = require 'dmc_corona.dmc_objects'

If you change the location of the library folder in your project to this:

dmc_corona.cfg

[DMC_CORONA]
LUA_PATH:JSON = [ "./lib/dmc_corona" ]

Then you would import modules like this:

local Websockets = require 'lib.dmc_corona.dmc_websockets'
local Objects = require 'lib.dmc_corona.dmc_objects'

Config File Contents

Module Settings

Any special configuration settings are defined by each module, so you will need to reference that module's API documentation to know what is possible for the config file.

The next parts discuss how those Property/Value pairs should be defined inside of the config file.

Sections

The config file is split into sections. Having sections provides a way to give each module its own namespace for properties so that there are no name clashes.

Each section name is the captalization fo the library or module name, eg dmc_corona converts to DMC_CORONA, dmc_objects converts to DMC_OBJECTS. Then each name is wrapped in square brackets like so: \[DMC_OBJECTS\].

Section Layout

The first section by default is the global namespace for the entire library and is named DMC_CORONA.

The sections which follow the global section can be listed in any order.

Here's an example config file showing only section names:

Config File Sections

[DMC_CORONA]

-- This is the general section for the entire library and is ALWAYS first


[DMC_AUTOSTORE]

-- This is the section for the module `dmc_autostore` only


[DMC_FACEBOOK]

-- This is the section for the module `dmc_facebook` only

Section Property Names and Values

Each module can have its own set of configuration properties and values. Here's a quick example of what name configs look like:

Example Name/Value Pairs

MAKE_GLOBAL:BOOL = true
TIMER_MIN:INT = 2000

Config-Property Rules

  • Property names are always capitalized

  • Values can be "cast" to one of the following types: Path JSON File Boolean Integer String (the default)

  • Property names and their cast have no spaces, etc "LUA_PATH:JSON", not "LUA_PATH : JSON""

Section Config Examples

[DMC_CORONA]

LUA_PATH:JSON = [ "./dmc_corona" ]


[DMC_KOMPATIBLE]

MAKE_GLOBAL:BOOL = true


[DMC_AUTOSTORE]

TIMER_MIN:INT = 2000