Lua:wideStringToByteTable

From Cheat Engine
Revision as of 17:28, 11 July 2025 by Leunsel (talk | contribs)
Jump to navigation Jump to search

function wideStringToByteTable(String) : Table

Converts a string to a wide string (UTF-16/Unicode) and then to a table of bytes.

Function Parameters

Parameter Type Description
String String The string to convert to a wide string and then to a byte table.

Returns

Table — A table containing the bytes representing the wide string (UTF-16/Unicode).

Examples

local bytes = wideStringToByteTable("ABC")
for i, b in ipairs(bytes) do
  print(string.format("Byte %d: %02X", i, b))
end
-- Output: 6 bytes representing "A", "B", "C" as UTF-16LE (e.g., 41 00 42 00 43 00)

See also

Related Functions