diff options
Diffstat (limited to 'tex/context/base/s-pre-71.lua')
-rw-r--r-- | tex/context/base/s-pre-71.lua | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/tex/context/base/s-pre-71.lua b/tex/context/base/s-pre-71.lua index 7d5c011f1..bfa45a705 100644 --- a/tex/context/base/s-pre-71.lua +++ b/tex/context/base/s-pre-71.lua @@ -1,63 +1,63 @@ -if not modules then modules = { } end modules ['steps'] = {
- version = 1.001,
- comment = "companion to steps.mkiv",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
-moduledata.steps = moduledata.steps or { }
-local steps = moduledata.steps
-
-local locations = {
- 'lefttop',
- 'middletop',
- 'righttop',
- 'middleleft',
- 'middle',
- 'middleright',
- 'leftbottom',
- 'middlebottom',
- 'rightbottom',
-}
-
-local done, current, previous, n
-
-function steps.reset_locations()
- done, current, previous, n = table.tohash(locations,false), 0, 0, 0
-end
-
-function steps.next_location(loc)
- previous = current
- n = n + 1
- loc = loc and loc ~= "" and tonumber(loc)
- while true do
- current = loc or math.random(1,#locations)
- if not done[current] then
- done[current] = true
- break
- end
- end
-end
-
-function steps.current_location()
- context(locations[current] or "")
-end
-
-function steps.previous_location()
- context(locations[previous] or "")
-end
-
-function steps.current_n()
- context(current)
-end
-
-function steps.previous_n()
- context(previous)
-end
-
-function steps.step()
- context(n)
-end
-
-steps.reset_locations()
+if not modules then modules = { } end modules ['steps'] = { + version = 1.001, + comment = "companion to steps.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.steps = moduledata.steps or { } +local steps = moduledata.steps + +local locations = { + 'lefttop', + 'middletop', + 'righttop', + 'middleleft', + 'middle', + 'middleright', + 'leftbottom', + 'middlebottom', + 'rightbottom', +} + +local done, current, previous, n + +function steps.reset_locations() + done, current, previous, n = table.tohash(locations,false), 0, 0, 0 +end + +function steps.next_location(loc) + previous = current + n = n + 1 + loc = loc and loc ~= "" and tonumber(loc) + while true do + current = loc or math.random(1,#locations) + if not done[current] then + done[current] = true + break + end + end +end + +function steps.current_location() + context(locations[current] or "") +end + +function steps.previous_location() + context(locations[previous] or "") +end + +function steps.current_n() + context(current) +end + +function steps.previous_n() + context(previous) +end + +function steps.step() + context(n) +end + +steps.reset_locations() |