VR-Forces 5.0.3 Lua Function Documentation

TranslatableStream

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

A TranslatableStream is a text stream class that can be translated by VR-Force for display in the GUI as text that is translated to the current language the user is displaying (as long as those translations exist.) See the VR-Forces Users Guide, section 2.5, for information about localizing the GUI.

To create a TranslatableStream, you must use the vrf:trUtf8() function, which converts a string into a TranslatableStream. If the string has parameter substitution characters in it (e.g. "%1"), then the arg function can be called on the TranslatableStream to add these arguments. One of the TranslatableStream print functions below can then be used to output the result, but it is more syntactically consistent to use the print functions defined in the Vrfutil module. See the discussion of printing in the HowToPrint module (at the top level of the Lua documentation).

Function List

arg (argument) Adds a new argument to match the next substitution placeholder ("%1", "%2", etc.) in the TranslatableStream.
printDebug () Prints the Translatable stream to the Debug console.
printError () Prints the Translatable stream to the Error console.
printInfo () Prints the Translatable stream to the Info console.
printVerbose () Prints the Translatable stream to the Verbose console.
printWarn () Prints the Translatable stream to the Error console.


Functions

arg (argument)
Adds a new argument to match the next substitution placeholder ("%1", "%2", etc.) in the TranslatableStream.

Parameters:

  • argument: The argument to add. This argument can be a string or a number.

Usage:

  • printWarn(vrf:trUtf8("this is a %1"):arg("test"))
  • vrf:trUtf8("Argument %1 and Two %2"):arg("One"):arg(2):printInfo()

Return value:

    A TranslatableStream.
printDebug ()
Prints the Translatable stream to the Debug console. See documentation for printing in the HowToPrint module.
printError ()
Prints the Translatable stream to the Error console. See documentation for printing in the HowToPrint module.
printInfo ()
Prints the Translatable stream to the Info console. See documentation for printing in the HowToPrint module.
printVerbose ()
Prints the Translatable stream to the Verbose console. See documentation for printing in the HowToPrint module.
printWarn ()
Prints the Translatable stream to the Error console. See documentation for printing in the HowToPrint module.

Copyright© 2023 MAK Technologies, Inc. All rights reserved.