Skip to content

Template

Template is an utility module, which can save any kind of value to be retrieved later. In Rethink this tool is mainly used to pass on classes to avoid any infinite recursion errors.


API

.NewGlobal(globalName, element, isLocked)

Parameter: globalName String Parameter: element Any Parameter: isLocked Boolean

Saves the element in a table with a key of globalName. isLocked argument prevents it from being overwritten.


.FetchGlobal(target)

Parameter: target String Returns: Element Any

Returns the global with the key of target.


.UpdateGlobal(target, element)

Parameter: target String Parameter: element Any

Updates the global value with the key of target to element.


.new(element, isLocked)

Parameter: element Any Parameter: isLocked Boolean

Constructs a new class with element. If isLocked is set to true Template:Update() calls will be ignored.


:Fetch()

Returns: Element Any

Returns the class' element. If the saved element is an instance, the duplicated version will be fetched.


:Update(element)

Parameter: element Any

Updates the class' element to element. If isLocked is set to true the request will get ignored.


:Destroy()

Destructs the class.