LIVM/faxmopcode.lua

9 lines
333 B
Lua
Raw Normal View History

2022-04-09 00:20:48 +03:00
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
}