I try make a table with some random numbers but I found a problem with this
code:
\starttext
\ctxluacode{v=math.random(400,600)/10;context(%0.1f,v) ;}
\bTABLE
\bTR\bTD Distance (cm) \eTD\bTD $\Delta t$ (s) \eTD\eTR
\bTR\bTD[nr=3] \ctxluacode{v=math.random(400,600)/10;context(%0.1f,v) ;}
Hi Jorge,
···date: 2013-11-27, Wednesday···from: DesdeChaves···
I try make a table with some random numbers but I found a problem with this
code:
\starttext
\ctxluacode{v=math.random(400,600)/10;context(%0.1f,v) ;}
\bTABLE
\bTR\bTD Distance (cm) \eTD\bTD $\Delta t$ (s) \eTD\eTR
Is there a way to pass arguments to getrandomnumber() function?
\startluacode
local mathrandom = math.random
local context= context
document.get_random_number = function (min,max,delta)
context (%0.1f, mathrandom (min, max) / decimal)
end
\stopluacode
···date: 2013-11-27, Wednesday···from: DesdeChaves···
Solved
\getrandomnumber{36}{56}{10}
Or define it monadic:
\def \getrandomnumber #1{\ctxluacode {document.get_random_number (#1)}}
Now you can use your original syntax:
\getrandomnumber {23, 42, 10}
Though it blurs the line between