Function; Message_FormatF - HWRM/KarosGraveyard GitHub Wiki

Message_FormatF{arg_types}(<template_string>, ...<args>)

Description

This is a collection of functions:

  • Message_FormatFw
  • Message_FormatFs
  • Message_FormatFf
  • Message_FormatFff
  • Message_FormatFffw
  • Message_FormatFffs
  • Message_FormatFsf
  • Message_FormatFss

They all work the same way: the first agument is a template string, and the remaining arguments are the values to insert into that string. See printf for replacement syntax & rules.

The type and number of arguments each function expects beyond the template string are indicated by the postfix letters. For example, Message_FormatFs expects a string, whereas Message_FormatFw expects a wide-char string (see here for more detail about these).

All Message_FormatF functions return a userdata type, which is presumably a wchar_t* string.

Wide char userdata doesn't appear to be convertable to Lua strings, and is only usable with certain other stock functions, i.e Subtitle_Messagew.

Arguments

Param Type Description
template_string string A string containing replacement symbols to be replaced by the proceeding arguments. See printf for replacement syntax & rules.
...args <various> Values to insert into the template_string. The type and number of arguments each function expects beyond the template string are indicated by the postfix letters of the given Format_MessageF function.

Examples

Message_FormatFs for string replacement:

local template = "Hello %s";
local str = "Fear";

local formatted = Message_FormatFs(template, str);

Subtitle_Messagew(formatted, 5); -- displays 'Hello Fear' for 5s

Message_FormatFf for number replacement:

local template = "The value of Pi is roughly %f";
local num = 3.14;

local formatted = Message_FormatFf(template, num);

Subtitle_Messagew(formatted, 5); -- displays 'The value of Pi is roughly 3.14' for 5s

Related Pages

⚠️ **GitHub.com Fallback** ⚠️