5 Node programming I/O Interface
Pascal Abresch edited this page 2022-04-08 18:42:34 +00:00

Nodes have an interface which can be used for the logic programming (I/O) interface here is the api description of the nodes (this is needed for any blocks that want to be considered for programming)

The actual value of a sparkoption is read first from the metadata and then from _sparkoption with spark.getoption(nodepos, optionname). the node table sets the default.

groups = {
    sparktech_io = true
}
_sparkoptionchanged = function(nodepos, optionname) end -- Update internal state
_sparkoption = {
	enabled = true
	brightness = 3
}

_sparkoutput = {
	brightness = function(nodepos) return 3 end
}
_sparkoutputtype = {
	brightness = type(3)
}

Here is the api description of sparktechs interface for this

spark.setoption(nodepos, optionname, value)
spark.getoption(nodepos, optionname)
spark.getoutput(nodepos, outputname)