Difference between revisions of "Lua:byteTableToString"

From Cheat Engine
Jump to navigation Jump to search
m (Syntax Highlighting.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
−
'''function''' byteTableToString(''Table'') ''':''' string
+
{{CodeBox|'''function''' byteTableToString(''Table'') ''':''' String}}
  
−
Converts a byte table to a string.
+
Converts a table of bytes to a string, where each byte represents the ASCII/ANSI value of the corresponding character.
  
−
 
+
===Function Parameters===
−
=== Function Parameters ===
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
−
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
 
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 12: Line 11:
 
|-
 
|-
 
|Table
 
|Table
−
|table
+
|Table
−
|The table of bytes to convert
+
|A table containing the bytes to convert to a string.
 
|}
 
|}
  
 +
===Returns===
 +
String — The resulting string formed from the byte values.
 +
 +
===Explanation===
 +
Each element in the table is interpreted as a character code (byte), and the resulting string is constructed by concatenating these characters in order.
  
−
== Examples ==
+
For example, <code>byteTableToString({0x41, 0x42, 0x43})</code> returns <code>"ABC"</code>.
−
Code:
 
−
  local bt = { 0x74, 0x65, 0x73, 0x74, 0x00 }
 
−
  local value = byteTableToString(bt)
 
−
  print(value)
 
  
−
Output:
+
===Examples===
−
  test
+
<syntaxhighlight lang="lua" line>
 +
local str = byteTableToString({0x41, 0x42, 0x43})
 +
print(str) -- Output: ABC
 +
</syntaxhighlight>
  
 +
{{LuaSeeAlso}}
  
−
== See also ==
+
{{RelatedStrings}}
−
* [[Lua]]
 
−
* [[Help_File:Script engine|Script engine]]
 
  
−
=== Related Functions ===
+
{{ReadWriteMemory}}
−
* [[ansiToUtf8]]
 
−
* [[utf8ToAnsi]]
 
−
* [[translate]]
 
−
* [[readBytes]]
 
−
* [[readInteger]]
 
−
* [[readQword]]
 
−
* [[readPointer]]
 
−
* [[readFloat]]
 
−
* [[readDouble]]
 
−
* [[readString]]
 
−
* [[writeBytes]]
 
−
* [[writeInteger]]
 
−
* [[writeQword]]
 
−
* [[writeFloat]]
 
−
* [[writeDouble]]
 
−
* [[writeString]]
 
−
* [[readBytesLocal]]
 
−
* [[readIntegerLocal]]
 
−
* [[readQwordLocal]]
 
−
* [[readPointerLocal]]
 
−
* [[readFloatLocal]]
 
−
* [[readDoubleLocal]]
 
−
* [[readStringLocal]]
 
−
* [[writeBytesLocal]]
 
−
* [[writeIntegerLocal]]
 
−
* [[writeQwordLocal]]
 
−
* [[writeFloatLocal]]
 
−
* [[writeDoubleLocal]]
 
−
* [[writeStringLocal]]
 
−
* [[wordToByteTable]]
 
−
* [[dwordToByteTable]]
 
−
* [[qwordToByteTable]]
 
−
* [[floatToByteTable]]
 
−
* [[doubleToByteTable]]
 
−
* [[stringToByteTable]]
 
−
* [[wideStringToByteTable]]
 
−
* [[byteTableToWord]]
 
−
* [[byteTableToDword]]
 
−
* [[byteTableToQword]]
 
−
* [[byteTableToFloat]]
 
−
* [[byteTableToDouble]]
 
−
* [[byteTableToWideString]]
 

Latest revision as of 15:49, 25 June 2026

<> Lua API Reference

function byteTableToString(Table) : String

Converts a table of bytes to a string, where each byte represents the ASCII/ANSI value of the corresponding character.

Function Parameters[edit]

Parameter Type Description
Table Table A table containing the bytes to convert to a string.

Returns[edit]

String — The resulting string formed from the byte values.

Explanation[edit]

Each element in the table is interpreted as a character code (byte), and the resulting string is constructed by concatenating these characters in order.

For example, byteTableToString({0x41, 0x42, 0x43}) returns "ABC".

Examples[edit]

1 local str = byteTableToString({0x41, 0x42, 0x43})
2 print(str) -- Output: ABC

Main Pages

Core Lua documentation entry points

◆ Lua
◆ Script Engine

String Related Lua Functions

Encoding conversion and localized text helpers