Module:ProtoFlux/doc: Difference between revisions

From Resonite Wiki
Create ProtoFlux Docs
 
Custom -> i made the param functional
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is the module the wiki uses to generate the Protoflux nodes UI's on every Protoflux page.
This is the Lua module for generating ProtoFlux UI elements on pages such as [[To String (ProtoFlux)]]


The localcolor var is where the colors are set for the node inputs and outputs on every page. Eventually when the Resonite Wiki recalculates it's chache, all the visuals on every node page will update to match these colors
Please note, due to caching, updates made to this module will not immediately take effect on pages using it.  
If you need to see changes right away, use the editor view of a given page, which will update immediately.


(TODO: Explain more?)
== Parameters ==
 
=== Name ===
Name of this ProtoFlux node. This should be the same as the name you see at the top of a given node in Resonite.
 
=== Category ===
Category for this ProtoFlux node. This is not the full category path, but only the direct parent - it should be the same as what appears at the bottom of a given node in Resonite.
 
=== Inline ===
 
Controls whether this node is displayed inline, or floats to the right. If this parameter is set, the node will draw inline, regardless of the value passed to it.
 
If you need content to flow below the element, use <code><nowiki><div style="clear:right;"></div></nowiki></code>, add the class <code>.floatnone</code> to an element, or use  other elements with a similar CSS style tag.
 
=== Inputs ===
A string containing a JSON-encoded array of Name/Type information for each input on this node. Example input might be similar to the following, which adds two inputs of type <code>String</code>, one named <code>Input1</code> and one named <code>Input2</code>
<pre>
[{"Name":"Input1", "Type":"String"}, {"Name":"Input2", "Type":"String"}]
</pre>
 
=== Outputs ===
A string containing a JSON-encoded array of Name/Type information for each output on this node. Example input might be similar to the following, which adds two outputs of type <code>bool</code>, one named <code>Output1</code> and one named <code>Output2</code>
<pre>
[{"Name":"Output1", "Type":"bool"}, {"Name":"Output2", "Type":"bool"}]
</pre>
 
=== Globals ===
A string containing a JSON-encoded array of Name/Type information for each global on this node. Example input might be similar to the following, which adds two inputs of type <code>User</code>, one named <code>Global1</code> and one named <code>Global2</code>
<pre>
[{"Name":"Global1", "Type":"User"}, {"Name":"Global2", "Type":"User"}]
</pre>
 
=== Custom ===
Either <code>true</code> or <code>false</code> (not case sensitive, defaults to <code>false</code>), if <code>true</code> the page is not added to [[:Category:ProtoFlux:All|ProtoFlux:All]]. This is mainly used for custom nodes.
<pre>
Custom=false
</pre>
 
== Example Usage ==
 
If we combine all of the above examples together, we end up with this template invocation:
<pre>
{{#Invoke:ProtoFlux|GenerateUI
|Name=Example Name
|Category=Example Category
|Inputs=
[
{"Name": "Input1", "Type": "Call"},
{"Name": "Input2", "Type": "String"}
]
|Outputs=
[
{"Name": "Output1", "Type": "bool"},
{"Name": "Output2", "Type": "bool"}
]
|Globals=
[
{"Name": "Global1", "Type": "User"},
{"Name": "Global2", "Type": "User"}
]
|}}
</pre>
 
which results in the following:
 
{{#Invoke:ProtoFlux|GenerateUI
|Name=Example Name
|Category=Example Category
|Inline=true
|Inputs=
[
{"Name": "Input1", "Type": "Call"},
{"Name": "Input2", "Type": "String"}
]
|Outputs=
[
{"Name": "Output1", "Type": "bool"},
{"Name": "Output2", "Type": "bool"}
]
|Globals=
[
{"Name": "Global1", "Type": "User"},
{"Name": "Global2", "Type": "User"}
]
|}}

Latest revision as of 21:55, 22 August 2024

This is the Lua module for generating ProtoFlux UI elements on pages such as To String (ProtoFlux)

Please note, due to caching, updates made to this module will not immediately take effect on pages using it. If you need to see changes right away, use the editor view of a given page, which will update immediately.

Parameters

Name

Name of this ProtoFlux node. This should be the same as the name you see at the top of a given node in Resonite.

Category

Category for this ProtoFlux node. This is not the full category path, but only the direct parent - it should be the same as what appears at the bottom of a given node in Resonite.

Inline

Controls whether this node is displayed inline, or floats to the right. If this parameter is set, the node will draw inline, regardless of the value passed to it.

If you need content to flow below the element, use <div style="clear:right;"></div>, add the class .floatnone to an element, or use other elements with a similar CSS style tag.

Inputs

A string containing a JSON-encoded array of Name/Type information for each input on this node. Example input might be similar to the following, which adds two inputs of type String, one named Input1 and one named Input2

[{"Name":"Input1", "Type":"String"}, {"Name":"Input2", "Type":"String"}]

Outputs

A string containing a JSON-encoded array of Name/Type information for each output on this node. Example input might be similar to the following, which adds two outputs of type bool, one named Output1 and one named Output2

[{"Name":"Output1", "Type":"bool"}, {"Name":"Output2", "Type":"bool"}]

Globals

A string containing a JSON-encoded array of Name/Type information for each global on this node. Example input might be similar to the following, which adds two inputs of type User, one named Global1 and one named Global2

[{"Name":"Global1", "Type":"User"}, {"Name":"Global2", "Type":"User"}]

Custom

Either true or false (not case sensitive, defaults to false), if true the page is not added to ProtoFlux:All. This is mainly used for custom nodes.

Custom=false

Example Usage

If we combine all of the above examples together, we end up with this template invocation:

{{#Invoke:ProtoFlux|GenerateUI
|Name=Example Name
|Category=Example Category
|Inputs=
[
{"Name": "Input1", "Type": "Call"},
{"Name": "Input2", "Type": "String"}
]
|Outputs=
[
{"Name": "Output1", "Type": "bool"},
{"Name": "Output2", "Type": "bool"}
]
|Globals=
[
{"Name": "Global1", "Type": "User"},
{"Name": "Global2", "Type": "User"}
]
|}}

which results in the following:

Example Name
Input1
Output1
Input2
Output2
Global1
null
Global2
null
Example Category