TextInSync

Package: Libraries.Multitasking.Types · Inherits from: Libraries.Language.Object

The TextInSync class holds one text that tasks on different lines may use at the same time. Each action is one step: no other line can change the text in the middle of it. Use it when several lines build one text, such as a report or a log: Append never loses what another line added, unlike getting the text, adding to it, and setting it back.

Example Code

use Libraries.Multitasking.Types.TextInSync
class Main
action Main
    TextInSync report
    report:Set("Results:")
    report:Append(" all done")
    output report:Get()
end
end

Actions

Append(text more)

This action adds text to the end, as one step, and returns the whole text after adding. Several lines appending at once never lose an addition, though which line's text comes first depends on which gets there first.

Parameters

  • more text: The text to add to the end.

Returns

text: The text after adding.

Example

use Libraries.Multitasking.Types.TextInSync

TextInSync log
log:Append("Started. ")
text current = log:Append("Finished.")

Get()

This action gets the text.

Returns

text: The text.

Example

use Libraries.Multitasking.Types.TextInSync

TextInSync common
text current = common:Get()

Set(text value)

This action sets the text.

Parameters

  • value text: The new text.

Example

use Libraries.Multitasking.Types.TextInSync

TextInSync common
common:Set("Ready")

Inherited Actions

3 actions from Libraries.Language.Object