Hi,

I'm trying to use IUP (v 3.30) and Lua to generate a plot with the x-axis tick 
labels formatted as a date string. The following simple code runs but generates 
a number of 'attempt to call a userdata value' errors, and prints random ASCII 
text (if anything is printed). Other callback functions appear to work.

x = {1582995600, 1583082000, 1583168400, 1583254800, 1583341200, 1583427600, 
1583514000, 1583600400, 1583683200, 1583769600}
y = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

local plot = iup.plot{axs_xtickauto = "YES", marginleft = 60, marginright = 5, 
axs_ylabelspacing = 5, axs_xtickrotatenumber = "YES"}

plot:Begin(0)
for i,v in ipairs(x) do
                print (os.date("%y/%m/%d", v), y[i])
                plot:Add (v, y[i])
end
plot:End()
---[[
-- gives error 'attempt to call a userdata value'
-- instructions within the callback are not executed
function plot:xtickformatnumber_cb(format, xv, decimal_symbol)
                return iup.DEFAULT, os.date("%y/%m/%d", xv)
end
--]]

local dlg = iup.dialog{plot; title='Test', size='HALFxHALF'}
dlg:show()

iup.MainLoop()

Any help would be appreciated.

Thanks,

Brian
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to