Difference between revisions of "Lua:stringToByteTable"
Jump to navigation
Jump to search
(Created page with ''''function''' stringToByteTable(''String'') Converts a string to a byte table. === Function Parameters === {|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" bo…') |
(→Related Functions) |
||
Line 40: | Line 40: | ||
=== Related Functions === | === Related Functions === | ||
+ | * [[ansiToUtf8]] | ||
+ | * [[utf8ToAnsi]] | ||
+ | * [[translate]] | ||
* [[readBytes]] | * [[readBytes]] | ||
* [[readInteger]] | * [[readInteger]] |
Revision as of 00:57, 10 March 2017
function stringToByteTable(String)
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
- 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
- wideStringToByteTable
- byteTableToWord
- byteTableToDword
- byteTableToQword
- byteTableToFloat
- byteTableToDouble
- byteTableToString
- byteTableToWideString