![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 7/23/2021 11:07 AM, Jorge Manuel wrote:
Dear Sirs
If I tried:
\starttext \startluacode sample = {10,30,30,40}
function MP.GetP() mp.print(sample) end \stopluacode
\startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, samples = {lua.MP.GetP()} , trace = true, maximum = 100, linewidth = 1mm, showlabels = false, originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode
\stoptext
This works.
But with an extra element in the sample table:
\starttext \startluacode sample = {10,30,30,40,50}
function MP.GetP() mp.print(sample) end \stopluacode
\startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, samples = {lua.MP.GetP()} , trace = true, maximum = 100, linewidth = 1mm, showlabels = false, originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode
\stoptext
Don't works anymore. Why? (watch out: samples is global in your code)
your lua.MP.GetP() becomes some mp quantity and 4 entries becomes a cmykcolor and you're just lucky that that works (reverse casting makes it a table) and there is no 5 element quantity so, you end up in scantokens not being able to understand it I'll think of a way to pass records (new submechanism) at some point but for now i added this: \startluacode document.samples = { { 10, 30, 30, 40, 50 } } \stopluacode \startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, trace = true, maximum = 100, linewidth = 1mm, showlabels = false, sampleset = "document.samples", originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode with the spec being some lua, so this will also work: sampleset = "table.load('foo.lua')", asuming foo.lua has this: return { { 10, 30, 30, 40, 50 } } ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------