How to get character code (ASCII and Unicode) in Lua

2 Answers

0 votes
local ch = 'a'

print(string.byte(ch))




--[[
run:

97

--]]

 



answered Jan 21, 2023 by avibootz
0 votes
local ch = 'a'

local char_code = string.byte(ch)

print(char_code)




--[[
run:

97

--]]

 



answered Jan 21, 2023 by avibootz
...