Looks reasonably comprehensive.
I think the body of
function table.getn(t) can simply be
return #t
Code: Select all
function table.getn(t)
return #t
end
Regarding other Lua changes, is it worth mentioning the formatting of numbers.
i.e.
string.format("%d",number) won't work if
number is not an integer.
It needs
string.format("%d",math.floor(number)) or similar to ensure the parameter is an integer.
That solution works for all Lua versions.
The
iup.SetGlobal("CUSTOMQUITMESSAGE","YES") seems OK in all IUP versions so doesn't need to be conditional.
Regarding IUP a popular simple dialogue involves
iup.GetParam(..) but a bug prevents the button labels being changed from
OK and
Cancel. The workaround is:
Code: Select all
function paramAction(iupDialog,intIndex)
if intIndex == iup.GETPARAM_MAP then -- Correct button labels needed for IUP 3.28 bug
iupDialog.Button1.Title = "Edit" -- Otherwise remain as OK and Cancel
iupDialog.Button2.Title = "Exit"
end
return 1
end
local isAns,strAns = iup.GetParam("Test",paramAction,"%u[Edit,Exit]") -- Displays dialogue with buttons Edit and Exit
and to add a Help button:
Code: Select all
function paramAction(iupDialog,intIndex)
if intIndex == iup.GETPARAM_MAP then -- Correct button labels needed for IUP 3.28 bug
iupDialog.Button1.Title = "Apply Rules"
iupDialog.Button2.Title = "Cancel Plugin"
elseif intIndex == (iup.GETPARAM_HELP or -4) then -- FH V5 needs -4
fhShellExecute("https://pluginstore.family-historian.co.uk/page/help/main-help-page","","","open")
end
return 1
end -- function paramAction