aboutsummaryrefslogtreecommitdiff
path: root/vendor/md5/src/compat-5.2.c
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/md5/src/compat-5.2.c')
-rw-r--r--vendor/md5/src/compat-5.2.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/md5/src/compat-5.2.c b/vendor/md5/src/compat-5.2.c
new file mode 100644
index 00000000..ce57660b
--- /dev/null
+++ b/vendor/md5/src/compat-5.2.c
@@ -0,0 +1,21 @@
1#include "lua.h"
2#include "lauxlib.h"
3#include "compat-5.2.h"
4
5#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501
6/*
7** Adapted from Lua 5.2.0
8*/
9void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
10 luaL_checkstack(L, nup+1, "too many upvalues");
11 for (; l->name != NULL; l++) { /* fill the table with given functions */
12 int i;
13 lua_pushstring(L, l->name);
14 for (i = 0; i < nup; i++) /* copy upvalues to the top */
15 lua_pushvalue(L, -(nup + 1));
16 lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
17 lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */
18 }
19 lua_pop(L, nup); /* remove upvalues */
20}
21#endif