Class l2df.manager.factory
Factory manager.
Info:
- Copyright: Atom-TM 2020
- Author: Abelidze, Kasai
Functions
| Manager:init([kwargs]) | Configure FactoryManager. |
| Manager:create([class[, kwargs[, ...]]]) | Create entity instance of the specified class. |
| Manager:scan(path) | Method for loading markup elements' classes. |
| Manager:add(element) | Method for adding new element to factory's engine. |
Functions
Methods- Manager:init([kwargs])
-
Configure FactoryManager.
Parameters:
-
kwargs
table
Keyword arguments.
- scanpaths string or {string,...} Directory path or array of paths to scan. (optional)
Returns:
-
kwargs
table
Keyword arguments.
- Manager:create([class[, kwargs[, ...]]])
-
Create entity instance of the specified class.
Parameters:
-
class
string or table
Lower-case class name. If table is passed instead of string,
classargument would be skipped and passed table would be used askwargsargument. (optional) -
kwargs
string or table
Could be a string containing path to the
.datfile to parse or a table with keyword arguments that would be passed to the creating object constructor. (optional) -
...
Would be passed to Entity:new() after
kwargsarray-part elements. (optional)
Returns:
-
class
string or table
Lower-case class name. If table is passed instead of string,
- Manager:scan(path)
-
Method for loading markup elements' classes.
Parameters:
-
path
string
Path to the folder containing files with
.luaor.datextension. For more information see helper.requireFolder(path) function.
-
path
string
Path to the folder containing files with
- Manager:add(element)
-
Method for adding new element to factory's engine.
Parameters:
-
element
table or l2df.class.entity
It could be both an entity class or table
containing
table.namestring field andtable:new(kwargs, ...)constructor.
Returns:
-
boolean
trueif the specifiedelementis valid andfalseotherwise. -
element
table or l2df.class.entity
It could be both an entity class or table
containing