diff options
| author | William Ahern <william@25thandclement.com> | 2016-06-24 19:00:25 -0700 |
|---|---|---|
| committer | William Ahern <william@25thandclement.com> | 2016-06-24 19:00:25 -0700 |
| commit | a63e737bd12e466937223c848387d0b704f02e31 (patch) | |
| tree | 6212f97965c01b783fc8153e3bba830d5176a032 /src/openssl.auxlib.lua | |
| parent | 82b9b3af389b70ed38963ca8d6e2aa9f69b16450 (diff) | |
| download | luaossl-a63e737bd12e466937223c848387d0b704f02e31.tar.gz luaossl-a63e737bd12e466937223c848387d0b704f02e31.tar.bz2 luaossl-a63e737bd12e466937223c848387d0b704f02e31.zip | |
refactor and add ashb's regression test for #53
Diffstat (limited to '')
| -rw-r--r-- | src/openssl.auxlib.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/openssl.auxlib.lua b/src/openssl.auxlib.lua new file mode 100644 index 0000000..4f00c25 --- /dev/null +++ b/src/openssl.auxlib.lua | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | local auxlib = {} | ||
| 2 | |||
| 3 | if _VERSION == "Lua 5.1" then | ||
| 4 | local _pairs = pairs | ||
| 5 | |||
| 6 | function auxlib.pairs(t) | ||
| 7 | if type(t) == "userdata" then | ||
| 8 | local mt = getmetatable(t) | ||
| 9 | |||
| 10 | if mt and mt.__pairs then | ||
| 11 | return mt.__pairs(t) | ||
| 12 | else | ||
| 13 | return _pairs(t) | ||
| 14 | end | ||
| 15 | end | ||
| 16 | end | ||
| 17 | else | ||
| 18 | auxlib.pairs = pairs | ||
| 19 | end | ||
| 20 | |||
| 21 | return auxlib | ||
