|  | @@ -333,6 +333,16 @@ static int lsp_redirect(lua_State *L)
 | 
											
												
													
														|  |      return 0;
 |  |      return 0;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +/* mg.send_file */
 | 
											
												
													
														|  | 
 |  | +static int lsp_send_file(lua_State *L)
 | 
											
												
													
														|  | 
 |  | +{
 | 
											
												
													
														|  | 
 |  | +    struct mg_connection *conn = lua_touserdata(L, lua_upvalueindex(1));
 | 
											
												
													
														|  | 
 |  | +    const char * filename = lua_tostring(L, -1);
 | 
											
												
													
														|  | 
 |  | +    mg_send_file(conn, filename);
 | 
											
												
													
														|  | 
 |  | +    return 0;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +/* mg.write for websockets */
 | 
											
												
													
														|  |  static int lwebsock_write(lua_State *L)
 |  |  static int lwebsock_write(lua_State *L)
 | 
											
												
													
														|  |  {
 |  |  {
 | 
											
												
													
														|  |  #ifdef USE_WEBSOCKET
 |  |  #ifdef USE_WEBSOCKET
 | 
											
										
											
												
													
														|  | @@ -441,6 +451,8 @@ static void prepare_lua_environment(struct mg_connection *conn, lua_State *L, co
 | 
											
												
													
														|  |          reg_function(L, "write", lwebsock_write, conn);
 |  |          reg_function(L, "write", lwebsock_write, conn);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    reg_function(L, "send_file", lsp_send_file, conn);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      reg_string(L, "version", CIVETWEB_VERSION);
 |  |      reg_string(L, "version", CIVETWEB_VERSION);
 | 
											
												
													
														|  |      reg_string(L, "document_root", conn->ctx->config[DOCUMENT_ROOT]);
 |  |      reg_string(L, "document_root", conn->ctx->config[DOCUMENT_ROOT]);
 | 
											
												
													
														|  |      reg_string(L, "auth_domain", conn->ctx->config[AUTHENTICATION_DOMAIN]);
 |  |      reg_string(L, "auth_domain", conn->ctx->config[AUTHENTICATION_DOMAIN]);
 |