Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
8c118bf4
Commit
8c118bf4
authored
May 17, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exported mg_prepare_lua_environment()
parent
2e232b33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
mod_lua.c
mod_lua.c
+4
-2
No files found.
mod_lua.c
View file @
8c118bf4
...
@@ -161,7 +161,7 @@ static void reg_function(struct lua_State *L, const char *name,
...
@@ -161,7 +161,7 @@ static void reg_function(struct lua_State *L, const char *name,
lua_rawset
(
L
,
-
3
);
lua_rawset
(
L
,
-
3
);
}
}
static
void
prepare_lua_environment
(
struct
mg_connection
*
conn
,
lua_State
*
L
)
{
void
mg_
prepare_lua_environment
(
struct
mg_connection
*
conn
,
lua_State
*
L
)
{
const
struct
mg_request_info
*
ri
=
mg_get_request_info
(
conn
);
const
struct
mg_request_info
*
ri
=
mg_get_request_info
(
conn
);
extern
void
luaL_openlibs
(
lua_State
*
);
extern
void
luaL_openlibs
(
lua_State
*
);
int
i
;
int
i
;
...
@@ -171,6 +171,8 @@ static void prepare_lua_environment(struct mg_connection *conn, lua_State *L) {
...
@@ -171,6 +171,8 @@ static void prepare_lua_environment(struct mg_connection *conn, lua_State *L) {
{
extern
int
luaopen_lsqlite3
(
lua_State
*
);
luaopen_lsqlite3
(
L
);
}
{
extern
int
luaopen_lsqlite3
(
lua_State
*
);
luaopen_lsqlite3
(
L
);
}
#endif
#endif
if
(
conn
==
NULL
)
return
;
// Register mg module
// Register mg module
lua_newtable
(
L
);
lua_newtable
(
L
);
...
@@ -243,7 +245,7 @@ static int handle_lsp_request(struct mg_connection *conn, const char *path,
...
@@ -243,7 +245,7 @@ static int handle_lsp_request(struct mg_connection *conn, const char *path,
}
else
{
}
else
{
// We're not sending HTTP headers here, Lua page must do it.
// We're not sending HTTP headers here, Lua page must do it.
if
(
ls
==
NULL
)
{
if
(
ls
==
NULL
)
{
prepare_lua_environment
(
conn
,
L
);
mg_
prepare_lua_environment
(
conn
,
L
);
if
(
conn
->
ctx
->
callbacks
.
init_lua
!=
NULL
)
{
if
(
conn
->
ctx
->
callbacks
.
init_lua
!=
NULL
)
{
conn
->
ctx
->
callbacks
.
init_lua
(
conn
,
L
);
conn
->
ctx
->
callbacks
.
init_lua
(
conn
,
L
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment