I wouldn't encourage this use of Mach Lua API but here is a function that works:
inst = mc.mcGetInstance()
profile = mc.mcProfileGetName(inst)
machDirectory = mc.mcCntlGetMachDir(inst)
local mINIFilePath = machDirectory .. "\\Profiles\\" .. profile .. "\\Machine.ini"
function findSignalByNumber(sigNum)
for line in io.lines(mINIFilePath) do
if signalFound then
local signalDesc = string.match(line, 'Desc') and true or false
if signalDesc then
description = line:gsub('Desc=', '')
mc.mcCntlSetLastError(inst, 'Signal' .. tostring(sigNum) .. ': ' .. tostring(description))
signalFound = false
break
end
else
signalFound = string.match(line, 'Signal' .. tostring(sigNum)) and true or false
end
end
end
findSignalByNumber(1142)
The output prints in the History log