To start, I created a simple test plugin:
Code: Select all
require("iuplua")
iup.SetGlobal("CUSTOMQUITMESSAGE", "YES")
local function f ()
return "a" + 2 -- will cause error
end -- f
local function err (x)
local function dialogError(pText)
local strText = pText
local function setArg(txtText)
strText = txtText
return iup.CLOSE
end -- local function setArg
----------------------------------------
-- Define IUP controls for user dialogue
----------------------------------------
local txtText = iup.text({
RasterSize = "100x100",
Expand = "Yes",
MULTILINE = "Yes",
Tip = "Error Message",
value = strText,
})
local btnLink = iup.button({
Title = "Close",
Expand = "No",
Tip = "Close",
FgColor = "0 128 0",
action = function()
return setArg(txtText.Value)
end,
})
local btnQuit = iup.button({
Title = "Quit",
Expand = "No",
Tip = "Quit",
FgColor = "255 0 0",
action = function()
return setArg(" ")
end,
})
local dialog = iup.dialog({
Title = "Error",
iup.vbox({
Expand = "Yes",
iup.hbox({
Margin = "1x1",
Expand = "Yes",
txtText,
}),
iup.hbox({ Expand = "Yes", btnLink, btnQuit }),
}),
RasterSize = "800x200",
MinSize = "800x200",
Padding = "4x4",
Gap = "9",
Margin = "8x8",
MinBox = "No",
MaxBox = "No",
DefaultEnter = btnLink,
DefaultEsc = btnQuit,
close_cb = function()
return setArg(" ")
end,
})
iup.Popup(dialog)
iup.Destroy(dialog)
return
end
--------------------------------------------------------------------------------
local sTrace = debug.traceback()
dialogError(x .. '\n' .. sTrace)
end
--------------------------------------------------------------------------------
local function main()
f()
end
--------------------------------------------------------------------------------
xpcall(main, err)
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:5: attempt to perform arithmetic on a string value
stack traceback:
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:73: in metamethod '__add'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:5: in upvalue 'f'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:81: in function <[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:80>
[C]: in function 'xpcall'
[string "C:\ProgramData\Calico Pie\Family Historian\Pl..."]:84: in main chunk
My problem is that everything is being prefixed by the full path, which means that I don't see the actual function names. Is there some way to fix it?
Thanks,
Shosh