summaryrefslogtreecommitdiff
path: root/mplife.lua
diff options
context:
space:
mode:
Diffstat (limited to 'mplife.lua')
-rw-r--r--mplife.lua53
1 files changed, 14 insertions, 39 deletions
diff --git a/mplife.lua b/mplife.lua
index c3067ab..7133a59 100644
--- a/mplife.lua
+++ b/mplife.lua
@@ -22,48 +22,23 @@ local C, Cs, Ct, P, R, S, match = lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg
mplife = {}
mplife.setup = mplife.setup or {}
-mplife.setup.current = mplife.setup.current or {}
-do
- local c = mplife.setup.current
+if context then
+ environment.loadluafile "mpliferc-global"
+ environment.loadluafile "mpliferc"
+else -- assuming we're staying in pwd
+ require "mpliferc"
+end
- --c.file = c.file or "examples/10x10_glider.gol"
- --c.file = c.file or "examples/gliders.gol"
- --c.file = c.file or "examples/ggun.gol"
- c.file = c.file or "examples/sships.gol"
- c.rule = c.rule or gol.parse_rule("B3/S23") -- default Conway
- c.init = c.init or gol.parse_file(c.file)
- c.last = c.init -- for successive mode
-
- c.pensize = .1
- c.color = { r = .6, g = .6, b = .8 }
- c.opacity = 1/3
- c.fade = true
- c.gestalt = "unitsquare" -- try "unitcircle"
-
- c.firstframe = 1
- c.frames = 5
-
- c.preamble = [[
-\setupcolors[state=start]
-\setupbackgrounds[state=start]
-\setuppapersize[S6][S6]
-
-\setuppagenumbering[state=stop,location=]
-
-\defineoverlay[back][\ctxlua{mplife.successive()}]
-
-\setupbackgrounds [page] [background=back]
-]]
- c.before_frame = [[
-\startMPcode
-pickup pencircle xyscaled (.25*]] .. c.pensize .. [[pt, ]] .. c.pensize .. [[pt) rotated 45;
-]]
- c.after_frame = [[
-currentpicture := currentpicture xysized (\the\paperwidth, \the\paperheight);
-\stopMPcode
-]]
+mplife.setup.current = {}
+
+do
+ local g, r, c = mplife.setup.global, mplife.setup.rc, mplife.setup.current
+ for key,_ in pairs(g) do
+ print(key, ">>>", tostring(r[key]) .. " or " .. tostring(g[key]))
+ c[key] = r[key] or g[key] -- prefer local settings
+ end
mplife.setup.current = c
end