Home »
Code Examples »
Lua Code Examples
Lua - Character and Byte Representations Code Example
The code for Character and Byte Representations
-- Byte value of first character
print(string.byte("Hello, world"))
-- Byte value of third character
print(string.byte("Hello, world",3))
-- Byte value of the first character from last
print(string.byte("Hello, world",-1))
-- Byte value of the second character from the last
print(string.byte("Hello, world",-2))
-- Internal Numeric ASCII Conversion
print(string.char(72))
--[[
Output:
72
108
100
108
H
--]]
Code by IncludeHelp,
on August 25, 2022 23:10