LuaLibraryUtils: Add formatEngineString
authorWuzzy
Wed, 28 Jun 2023 22:14:36 +0000
changeset 2261 55bd0ae9d187
parent 2260 e9eccb1eeac4
child 2262 6dc92adc347a
LuaLibraryUtils: Add formatEngineString
LuaLibraryUtils.wiki
--- a/LuaLibraryUtils.wiki	Wed Jun 28 22:11:07 2023 +0000
+++ b/LuaLibraryUtils.wiki	Wed Jun 28 22:14:36 2023 +0000
@@ -19,7 +19,7 @@
 == `eraseMap([flush])` ==
 Completely erase all land from current map. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.
 
-== `updateChallengeRecord(recordType, value[, stat])` (1.0.0) ==
+== `updateChallengeRecord(recordType, value[, stat])` ==
 Report a new team record attempt in a [Missions mission] (preferably challenge missions). In missions, the team file of the mission team (see `AddMissionTeam` for more infos) can store several records (such as highscores) which will be shown in the frontend when the mission is selected. Note this only works for non-campaign missions so far.
 
 Calling this function means the team has made a record attempt of a given record type (e.g. fastest time or highscore) with a given `value`. If the team's own record has been beaten, or is has set the first record, the team file is being updated.
@@ -38,7 +38,7 @@
 updateChallengeRecord("Highscore", 12000)
 </code>
 
-== `getReadableChallengeRecord(recordType)` (1.0.0) ==
+== `getReadableChallengeRecord(recordType)` ==
 Returns a human-readable description of a team record of the mission team (see also: `AddMissionTeam`) for the current challenge [Missions mission]. Team records are read from the team file. `recordType` is a record type. Possible record types are listed [ConfigurationFiles#%5BMission%2520%3CMISSION_NAME%3E%5D here]. This can be useful to display something in `ShowMission`.
 
 If the team does not have a record for the given record type yet, the empty string is returned. If the record type is invalid, `nil` is returned.
@@ -51,12 +51,24 @@
 -- Shows the mission panel and the current time record.
 </code>
 
-== `integerSqrt(num)` (1.0.0) ==
+== `integerSqrt(num)` ==
 Calculates the square root of `num`, but rounded to an integer. This function is desync-safe.
 
-== `integerHypotenuse(x, y)` (1.0.0) ==
+== `integerHypotenuse(x, y)` ==
 Calculates the hypotenuse of a triangle with legs x, y, but rounded to an integer. This function is desync-safe.
 
+== `formatEngineString(text, ...)` ==
+Insert parameters %1 to %9 into an engine string and returns the result.
+
+ * `text`: engine string with parameters (from `GetEngineString`)
+ * `...`: Variable number of arguments to insert into the string, if the engine string needs them (placeholders like `%1`). The number of arguments *must* match the number of available arguments of the engine string
+
+Example:
+
+<code language="lua">
+formatEngineString(GetEngineString("TMsgStrId", sidWinner), "My Team")
+-- to create a string showing the winning team.</code>
+
 == Standardized land tint colors ==
 There are some “standard” tint colors for placed girders and other sprites which are defined to allow more consistency, if it is desired. These values are used in !TechRacer, !HedgeEditor and the basic movement training to colorize girders consistently: