Homeworld 2 : Functionformat
Karos Graveyard ::
Function Reference :: Scope Reference :: Variable Reference
format(<sFormatString>, <vElement1>, <vElement2>, ...)

Description (from LUA 4 Manual: 6.2 String Manipulation
"Returns a formatted version of its variable number of arguments following the description given in its first argument (which must be a string). The format string follows the same rules as the printf family of standard C functions. The only differences are that the options/modifiers *, l, L, n, p, and h are not supported, and there is an extra option, q. The q option formats a string in a form suitable to be safely read back by the Lua interpreter: The string is written between double quotes, and all double quotes, returns, and backslashes in the string are correctly escaped when written. For instance, the call

format('%q', 'a string with "quotes" and \n new line')

will produce the string:

"a string with \"quotes\" and \
new line"

Conversions can be applied to the n-th argument in the argument list, rather than the next unused argument. In this case, the conversion character % is replaced by the sequence %d$, where d is a decimal digit in the range [1,9], giving the position of the argument in the argument list. For instance, the call format("%2$d -> %1$03d", 1, 34) will result in "34 -> 001". The same argument can be used in more than one conversion.
The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument, whereas q and s expect a string. The * modifier can be simulated by building the appropriate format string. For example, "%*g" can be simulated with "%"..width.."g".
Neither the format string nor the string values to be formatted with %s can contain embedded zeros. %q handles string values with embedded zeros."

Example

Arguments
<sFormatString>: the string to format.
<vElement1> to <vElementN>: the elements to use when formatting <sFormatString>.

Related Functions
:: ::
Hide Download Bar
Ctrl + Shift + Z = Show/Hide Download Bar
Downloads
Download Manager (S3)
Clear
Left Click: Clear All Finished
Right Click: Undo last clear
100%
Download History
Download list is empty
FunctionfogSetStart.html
100%
00:00
581 KB
2.56 MB/s
FunctionfogSetStart.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogSetStart.html
Status:
581 KB / 581 KB ( 2.56 MB/s )
File Size:
581 KB
Virus scan:
Time Start:
2019.08.21 - 22:53:24
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
2.43 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionfogSetEnd.html
100%
--:--
581 KB
-.--
FunctionfogSetEnd.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogSetEnd.html
Status:
581 KB / 581 KB ( -.-- )
File Size:
581 KB
Virus scan:
Time Start:
2019.08.21 - 22:53:36
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
620 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionfogSetDensity.html
100%
00:00
581 KB
2.64 MB/s
FunctionfogSetDensity.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogSetDensity.html
Status:
581 KB / 581 KB ( 2.64 MB/s )
File Size:
581 KB
Virus scan:
Time Start:
2019.08.21 - 22:53:47
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
2.50 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionfogSetColour.html
100%
00:00
581 KB
1.65 MB/s
FunctionfogSetColour.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogSetColour.html
Status:
581 KB / 581 KB ( 1.65 MB/s )
File Size:
581 KB
Virus scan:
Time Start:
2019.08.21 - 22:53:56
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
1.59 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionfogSetActive.html
100%
--:--
581 KB
-.--
FunctionfogSetActive.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogSetActive.html
Status:
581 KB / 581 KB ( -.-- )
File Size:
581 KB
Virus scan:
Time Start:
2019.08.21 - 22:54:04
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
532 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionfogAddInterpolator.html
100%
--:--
538 KB
-.--
FunctionfogAddInterpolator.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionfogAddInterpolator.html
Status:
538 KB / 538 KB ( -.-- )
File Size:
538 KB
Virus scan:
Time Start:
2019.08.21 - 22:54:28
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
764 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
Functionflush.html
100%
00:00
539 KB
2.28 MB/s
Functionflush.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\Functionflush.html
Status:
539 KB / 539 KB ( 2.28 MB/s )
File Size:
539 KB
Virus scan:
Time Start:
2019.08.21 - 22:54:37
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
2.17 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
Functionfloor.html
100%
00:00
538 KB
2.16 MB/s
Functionfloor.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\Functionfloor.html
Status:
538 KB / 538 KB ( 2.16 MB/s )
File Size:
538 KB
Virus scan:
Time Start:
2019.08.21 - 22:54:50
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
2.06 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop