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,
class
argument would be skipped and passed table would be used askwargs
argument. (optional) -
kwargs
string or table
Could be a string containing path to the
.dat
file 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
kwargs
array-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
.lua
or.dat
extension. 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.name
string field andtable:new(kwargs, ...)
constructor.
Returns:
-
boolean
true
if the specifiedelement
is valid andfalse
otherwise. -
element
table or l2df.class.entity
It could be both an entity class or table
containing