1if not modules then modules = { } end modules ['mlib-lua'] = {
2 version = 1.001,
3 comment = "companion to mlib-ctx.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
9local type = type
10local insert, remove = table.insert, table.remove
11
12local set = mp.set
13local get = mp.get
14
15local currentmpx = nil
16local stack = { }
17
18local get_numeric = mplib.get_numeric
19local get_integer = mplib.get_integer
20local get_string = mplib.get_string
21local get_boolean = mplib.get_boolean
22local get_path = mplib.get_path
23local set_path = mplib.set_path
24
25get.numeric = function(s) return get_numeric(currentmpx,s) end
26get.number = function(s) return get_numeric(currentmpx,s) end
27get.integer = function(s) return get_integer(currentmpx,s) end
28get.string = function(s) return get_string (currentmpx,s) end
29get.boolean = function(s) return get_boolean(currentmpx,s) end
30get.path = function(s) return get_path (currentmpx,s) end
31set.path = function(s,t) return set_path (currentmpx,s,t) end
32
33function metapost.pushscriptrunner(mpx)
34 insert(stack,mpx)
35 currentmpx = mpx
36end
37
38function metapost.popscriptrunner()
39 currentmpx = remove(stack,mpx)
40end
41
42function metapost.currentmpx()
43 return currentmpx
44end
45
46local status = mplib.status
47
48function metapost.currentmpxstatus()
49 return status and status(currentmpx) or 0
50end
51 |