aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-08-13 15:11:26 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-08-13 15:11:26 +1000
commite4cdcc5eb020b937182b7a8660c644485a188531 (patch)
tree1b85499d537981059fe909958544adc007c6cbc1
parent654d98141f6ce1153eb6c5d35ab39d1f5f9001c5 (diff)
downloadluaossl-e4cdcc5eb020b937182b7a8660c644485a188531.tar.gz
luaossl-e4cdcc5eb020b937182b7a8660c644485a188531.tar.bz2
luaossl-e4cdcc5eb020b937182b7a8660c644485a188531.zip
add name:each() as an alias for the __pairs metamethod
__pairs is not respected in lua 5.1
-rw-r--r--doc/luaossl.tex6
-rw-r--r--src/openssl.c1
2 files changed, 6 insertions, 1 deletions
diff --git a/doc/luaossl.tex b/doc/luaossl.tex
index 8695949..eef4444 100644
--- a/doc/luaossl.tex
+++ b/doc/luaossl.tex
@@ -362,10 +362,14 @@ field & description\\\hline
.blob & raw string value of the component
\end{tabular}
-\subsubsection[\fn{name:\_\_pairs}]{\fn{name:\_\_pairs()}}
+\subsubsection[\fn{name:each}]{\fn{name:each()}}
Returns a key-value iterator over the distinguished name components. The key is either the short, long, or OID identifier, with preference for the former.
+\subsubsection[\fn{name:\_\_pairs}]{\fn{name:\_\_pairs()}}
+
+Equal to \module{name:each}
+
\end{Module}
diff --git a/src/openssl.c b/src/openssl.c
index 827aa7d..4ffad71 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -5121,6 +5121,7 @@ static int xn__tostring(lua_State *L) {
static const auxL_Reg xn_methods[] = {
{ "add", &xn_add },
{ "all", &xn_all },
+ { "each", &xn__pairs },
{ NULL, NULL },
};