luat-lua.lua /size: 1090 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
luat-lua
'
]
=
{
2
version
=
1
.
001
,
3
comment
=
"
companion to luat-lib.mkiv
"
,
4
author
=
"
Hans Hagen, PRAGMA-ADE, Hasselt NL
"
,
5
copyright
=
"
PRAGMA ADE / ConTeXt Development Team
"
,
6
license
=
"
see context related readme files
"
7
}
8 9
if
lua
then
do
10 11
local
delayed
=
{
}
12 13
function
lua
.
flushdelayed
(
...
)
14
local
t
=
delayed
15
delayed
=
{
}
16
for
i
=
1
,
#
t
do
17
t
[
i
]
(
...
)
18
end
19
end
20 21
function
lua
.
delay
(
f
)
22
delayed
[
#
delayed
+
1
]
=
f
23
end
24 25
function
lua
.
flush
(
...
)
26
context
.
directlua
(
"
lua.flushdelayed(%,t)
"
,
{
...
}
)
27
end
28 29
end
end
30 31
-- See mk.pdf for an explanation of the following code:
32
--
33
-- function test(n)
34
-- lua.delay(function(...)
35
-- context("pi: %s %s %s",...)
36
-- context.par()
37
-- end)
38
-- lua.delay(function(...)
39
-- context("more pi: %s %s %s",...)
40
-- context.par()
41
-- end)
42
-- context("\\setbox0=\\hbox{%s}",math.pi*n)
43
-- local box = tex.box[0]
44
-- lua.flush(box.width,box.height,box.depth)
45
-- end
46