LIVM/faxmopcode.lua
2022-04-09 04:20:48 +07:00

9 lines
No EOL
333 B
Lua

local f = io.open("opcodelist")
local opcodes, reopcodes = {}, {}
for line in f:lines() do if #line > 0 then opcodes[#opcodes + 1] = line end end
f:close()
for k, v in pairs(opcodes) do reopcodes[v] = k end
return {
getName = function(index) return opcodes[index + 1] end,
getIndex = function(name) return reopcodes[name] - 1 end
}