summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpiv/mp-luas.mpiv
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context/base/mpiv/mp-luas.mpiv')
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv19
1 files changed, 17 insertions, 2 deletions
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index 293ebadaf..e5cfe0371 100644
--- a/metapost/context/base/mpiv/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -225,8 +225,23 @@ vardef texstr(expr name) = lua.mp.texstr(name) enddef ;
% endfor cycle ;
% \stopMPcode
-def inpath suffix p =
- = 1 step 1 until lua.mp.mf_path_length(str p)
+% def inpath suffix p =
+% = 1 step 1 until lua.mp.mf_path_length(str p)
+% enddef ;
+
+% def inpath suffix p =
+% % = 1 step 1 until lua.mp.mf_path_length(str p)
+% = 1 step 1 until (begingroup save n ; n := lua.mp.mf_path_length(str p) ; if n = 0 : 1 else : n fi endgroup)
+% enddef ;
+
+def inpath suffix p = % permits p[0]
+ = 1 step 1 until
+ begingroup
+ save mfun_inpath_r,mfun_inpath_n ; path mfun_inpath_r ;
+ mfun_inpath_r = p ;
+ mfun_inpath_n := lua.mp.mf_path_length(str mfun_inpath_r) ;
+ if mfun_inpath_n = 0 : 1 else : mfun_inpath_n fi
+ endgroup
enddef ;
vardef pointof primary i = lua.mp.mf_path_point(i) enddef ;