mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
Support build for Lua 5.1 (for LuaJIT), Lua 5.2 and Lua 5.3 (Step 3/?)
See #195
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
/* Project internal header to allow main.c to call a non-public function in
|
||||
* mod_lua.inl */
|
||||
|
||||
void lua_civet_open_all_libs(lua_State *L);
|
||||
void civetweb_open_lua_libs(lua_State *L);
|
||||
12
src/main.c
12
src/main.c
@@ -651,15 +651,9 @@ static void set_absolute_path(char *options[],
|
||||
}
|
||||
|
||||
#ifdef USE_LUA
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lua_civet.h"
|
||||
|
||||
#if LUA_VERSION_NUM == 501
|
||||
/* Lua 5.1 detected */
|
||||
#define LUA_OK 0
|
||||
#endif
|
||||
|
||||
#include "civetweb_lua.h"
|
||||
#include "civetweb_private_lua.h"
|
||||
|
||||
static int run_lua(const char *file_name)
|
||||
{
|
||||
@@ -677,7 +671,7 @@ static int run_lua(const char *file_name)
|
||||
fprintf(stderr, "Error: Cannot create Lua state\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
lua_civet_open_all_libs(L);
|
||||
civetweb_open_lua_libs(L);
|
||||
|
||||
lua_ret = luaL_loadfile(L, file_name);
|
||||
if (lua_ret != LUA_OK) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "civetweb_lua.h"
|
||||
|
||||
#include "lua_civet.h"
|
||||
#include "civetweb_private_lua.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
static void *
|
||||
@@ -1100,7 +1099,7 @@ static void prepare_lua_request_info(struct mg_connection *conn, lua_State *L)
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
|
||||
void lua_civet_open_all_libs(lua_State *L)
|
||||
void civetweb_open_lua_libs(lua_State *L)
|
||||
{
|
||||
{
|
||||
extern void luaL_openlibs(lua_State *);
|
||||
@@ -1144,7 +1143,7 @@ static void prepare_lua_environment(struct mg_context *ctx,
|
||||
const char *script_name,
|
||||
int lua_env_type)
|
||||
{
|
||||
lua_civet_open_all_libs(L);
|
||||
civetweb_open_lua_libs(L);
|
||||
|
||||
#if LUA_VERSION_NUM != 501
|
||||
luaL_newmetatable(L, LUASOCKET);
|
||||
|
||||
Reference in New Issue
Block a user