Difference between revisions of "Lua:stringToByteTable"

From Cheat Engine
Jump to navigation Jump to search
(Related Functions)
Line 1: Line 1:
'''function''' stringToByteTable(''String'')
+
'''function''' stringToByteTable(''String'') ''':''' table
  
 
Converts a string to a byte table.
 
Converts a string to a byte table.

Revision as of 02:02, 11 March 2017

function stringToByteTable(String) : table

Converts a string to a byte table.


Function Parameters

Parameter Type Description
String string The string to convert to a byte table


Examples

 local bt = stringToByteTable('player.weapons.rifle')
 bt[#bt + 1] = 0
 writeBytes('00123ABC', bt)


Code:

 local bt = stringToByteTable('test')
 for i, v in ipairs(bt) do
   print(i - 1, string.format('%02X', v))
 end

Output:

 0 74 
 1 65 
 2 73 
 3 74 


See also

Related Functions