Hexadecimal table.


tX = {
["h0"]=1,["h1"]=2, ["h2"]=3, ["h3"]=4, ["h4"]=5, ["h5"]=6, ["h6"]=7, ["h7"]=8,
["h8"]=9,["h9"]=10,["hA"]=11,["hB"]=12,["hC"]=13,["hD"]=14,["hE"]=15,["hF"]=16}
tY = {
["0"]=1,["1"]=2, ["2"]=3, ["3"]=4, ["4"]=5, ["5"]=6, ["6"]=7, ["7"]=8,
["8"]=9,["9"]=10,["A"]=11,["B"]=12,["C"]=13,["D"]=14,["E"]=15,["F"]=16}
tHex={
--|0|-|1|-|2|-|3|-|4|-|5|-|6|-|7|-|8|-|9|-|a|-|b|-|c|-|d|-|e|-|f|------|
 {"~","0","!","A","Q"," "," ","a","q"," "," "," "," "," "," "," "},--|0|
 {" ","1","'","B","R"," "," ","b","r"," "," "," "," "," "," "," "},--|1|
 {" ","2","#","C","S"," "," ","c","s"," "," "," "," "," "," "," "},--|2|
 {" ","3","$","D","T"," "," ","d","t"," "," "," "," "," "," "," "},--|3|
 {" ","4","%","E","U"," "," ","e","u"," "," "," "," "," "," "," "},--|4|
 {" ","5","|","F","V"," "," ","f","v"," "," "," "," "," "," "," "},--|5|
 {" ","6","(","G","W"," "," ","g","w"," "," "," "," "," "," "," "},--|6|
 {" ","7",")","H","X"," "," ","h","x"," "," "," "," "," "," "," "},--|7|
 {" ","8","*","I","Y"," "," ","i","y"," "," "," "," "," "," "," "},--|8|
 {" ","9","+","J","Z"," "," ","j","z"," "," "," "," "," "," "," "},--|9|
 {" ","<",",","K"," "," "," ","k"," "," "," "," "," "," "," "," "},--|a|
 {" ","=","-","L"," "," "," ","l"," "," "," "," "," "," "," "," "},--|b|
 {" ",">",".","M"," "," "," ","m"," "," "," "," "," "," "," "," "},--|c|
 {" ","?","/","N"," "," "," ","n"," "," "," "," "," "," "," "," "},--|d|
 {" ","[",":","O"," "," "," ","o"," "," "," "," "," "," "," "," "},--|e|
 {" ","]",";","P"," "," "," ","p"," "," "," "," "," "," "," "," "}---|f|
-----------------------------------------------------------------------|
}
function symbTable(X,Y)
sSymb = tHex[tX[X]][tY[Y]]
return sSymb
end

tHB={
["00"]="0",["01"]="1",["02"]="2",["03"]="3",["10"]="4",["11"]="5",["12"]="6",["13"]="7",
["20"]="8",["21"]="9",["22"]="A",["23"]="B",["30"]="C",["31"]="D",["32"]="E",["33"]="F"
}
function decodeHB(n1,n2)
sec="h"..tHB[n1]
hSymb=symbTable(sec,tHB[n2])
return hSymb
end


This is analogue ASCII table, I will use it in some of its programs

How it works:
need to tell the functions of the coordinates of the symbol at this table:


function hex.symbTable(x, y) is a hexadecimal number
function hex.decodeHB(x, y) is a hexadecimal number, consisting of two nibbles

Symbol "h" in horizontally line table "hex" serves to define the beginning of the byte

Example of using:


local a="h2"
local b="0"
hex.symbTable(a,:(/>/>

--|or|

local x = "00"
local y = "02"
hex.decodeHB(x,y)

---+=====================+---
---| "hex" this filename +---
---|  result: symbol "!" +---
---+=====================+---