Commit 1b3a1b74 authored by Jurie Horneman's avatar Jurie Horneman

Exposed Lua support functions.

parent 8dd76e6e
...@@ -3704,19 +3704,19 @@ static void *mmap(void *addr, int64_t len, int prot, int flags, int fd, ...@@ -3704,19 +3704,19 @@ static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
static void reg_string(struct lua_State *L, const char *name, const char *val) { void reg_string(struct lua_State *L, const char *name, const char *val) {
lua_pushstring(L, name); lua_pushstring(L, name);
lua_pushstring(L, val); lua_pushstring(L, val);
lua_rawset(L, -3); lua_rawset(L, -3);
} }
static void reg_int(struct lua_State *L, const char *name, int val) { void reg_int(struct lua_State *L, const char *name, int val) {
lua_pushstring(L, name); lua_pushstring(L, name);
lua_pushinteger(L, val); lua_pushinteger(L, val);
lua_rawset(L, -3); lua_rawset(L, -3);
} }
static void reg_function(struct lua_State *L, const char *name, void reg_function(struct lua_State *L, const char *name,
lua_CFunction func, struct mg_connection *conn) { lua_CFunction func, struct mg_connection *conn) {
lua_pushstring(L, name); lua_pushstring(L, name);
lua_pushlightuserdata(L, conn); lua_pushlightuserdata(L, conn);
......
...@@ -112,6 +112,14 @@ void *mg_start_thread(void *(*func)(void *), void *param); ...@@ -112,6 +112,14 @@ void *mg_start_thread(void *(*func)(void *), void *param);
char *mg_md5(char buf[33], ...); char *mg_md5(char buf[33], ...);
int mg_authorize_digest(struct mg_connection *c, FILE *fp); int mg_authorize_digest(struct mg_connection *c, FILE *fp);
// Lua utility functions
#ifdef MONGOOSE_USE_LUA
static void reg_string(struct lua_State *L, const char *name, const char *val);
static void reg_int(struct lua_State *L, const char *name, int val);
static void reg_function(struct lua_State *L, const char *name,
lua_CFunction func, struct mg_connection *conn);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif // __cplusplus #endif // __cplusplus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment