diff --git a/src/core/interceptormanager.cpp b/src/core/interceptormanager.cpp index 07a0c88..896a1fa 100644 --- a/src/core/interceptormanager.cpp +++ b/src/core/interceptormanager.cpp @@ -69,8 +69,8 @@ bool fastweb::interceptor_manager::callback(network::http::reqpack* reqpack, con } module::request m_request(reqpack->request()); module::response m_response(reqpack->response()); - (*lua->state)["response"] = m_response; - (*lua->state)["request"] = m_request; + (*lua->state)["fw_response"] = m_response; + (*lua->state)["fw_request"] = m_request; sol::protected_function_result result = script(); if (!result.valid()) { diff --git a/src/core/subscribemanager.cpp b/src/core/subscribemanager.cpp index 7759303..b8380b2 100644 --- a/src/core/subscribemanager.cpp +++ b/src/core/subscribemanager.cpp @@ -71,8 +71,8 @@ bool fastweb::subscribe_manager::callback(network::http::request* request, netwo } module::request m_request(request); module::response m_response(response); - (*lua->state)["response"] = m_response; - (*lua->state)["request"] = m_request; + (*lua->state)["fw_response"] = m_response; + (*lua->state)["fw_request"] = m_request; sol::protected_function_result result = script(); if (!result.valid()) { diff --git a/src/module/codec.cpp b/src/module/codec.cpp index f37dcb8..4195119 100644 --- a/src/module/codec.cpp +++ b/src/module/codec.cpp @@ -44,7 +44,7 @@ std::string module::codec::md5(const std::string& value) void module::codec::regist(sol::state* lua) { - lua->new_usertype("codec", + lua->new_usertype("fw_codec", "url_de", &module::codec::url_de, "url_en", &module::codec::url_en, "to_utf8", &module::codec::to_utf8, diff --git a/src/module/globalfuns.cpp b/src/module/globalfuns.cpp index 98aabc1..6f0f16e 100644 --- a/src/module/globalfuns.cpp +++ b/src/module/globalfuns.cpp @@ -29,13 +29,13 @@ std::string module::globalfuncs::website_dir(sol::this_state ts) } void module::globalfuncs::regist(sol::state* lua) { - lua->set_function("set_ptr", module::globalfuncs::set_ptr); - lua->set_function("get_str", module::globalfuncs::get_str); - lua->set_function("set_str", module::globalfuncs::set_str); - lua->set_function("make_software_guid", module::globalfuncs::make_software_guid); - lua->set_function("throw_string", module::globalfuncs::throw_string); - lua->set_function("print", module::globalfuncs::print); - lua->set_function("website_dir", module::globalfuncs::website_dir); + lua->set_function("fw_set_ptr", module::globalfuncs::set_ptr); + lua->set_function("fw_get_str", module::globalfuncs::get_str); + lua->set_function("fw_set_str", module::globalfuncs::set_str); + lua->set_function("fw_make_software_guid", module::globalfuncs::make_software_guid); + lua->set_function("fw_throw_string", module::globalfuncs::throw_string); + lua->set_function("fw_print", module::globalfuncs::print); + lua->set_function("fw_website_dir", module::globalfuncs::website_dir); } std::string module::globalfuncs::make_software_guid() diff --git a/src/module/http/httpclient.cpp b/src/module/http/httpclient.cpp index 706f427..f060897 100644 --- a/src/module/http/httpclient.cpp +++ b/src/module/http/httpclient.cpp @@ -62,7 +62,7 @@ ushort module::httpclient::status() void module::httpclient::regist(sol::state* lua) { - lua->new_usertype("httpclient", + lua->new_usertype("fw_httpclient", "new", sol::constructors(), "get", &module::httpclient::get, "post", &module::httpclient::post, diff --git a/src/module/http/interceptor.cpp b/src/module/http/interceptor.cpp index 498f18f..e7044ad 100644 --- a/src/module/http/interceptor.cpp +++ b/src/module/http/interceptor.cpp @@ -52,7 +52,7 @@ void module::interceptor::clear(sol::this_state ts) void module::interceptor::regist(sol::state* lua) { - lua->new_usertype("interceptor", + lua->new_usertype("fw_interceptor", "add", &module::interceptor::add, "remove", &module::interceptor::remove, "exist", &module::interceptor::exist, diff --git a/src/module/http/request.cpp b/src/module/http/request.cpp index 9cf23fd..858cee2 100644 --- a/src/module/http/request.cpp +++ b/src/module/http/request.cpp @@ -87,7 +87,7 @@ bool module::request::write_file(const std::string& name, const std::string& fil void module::request::regist(sol::state* lua) { // 绑定 Request 类到 Lua - lua->new_usertype("module_request", + lua->new_usertype("fw_request", "header", &module::request::header, "method", &module::request::method, "filepath", &module::request::filepath, diff --git a/src/module/http/response.cpp b/src/module/http/response.cpp index 2e24b6e..1d191e9 100644 --- a/src/module/http/response.cpp +++ b/src/module/http/response.cpp @@ -30,7 +30,7 @@ module::response::~response() void module::response::regist(sol::state* lua) { // 绑定 Request 类到 Lua - lua->new_usertype("module_response", + lua->new_usertype("fw_response", "send_data", &module::response::send_data, "send", &module::response::send, "send_file", &module::response::send_file, diff --git a/src/module/http/session.cpp b/src/module/http/session.cpp index 7f016e7..2584541 100644 --- a/src/module/http/session.cpp +++ b/src/module/http/session.cpp @@ -61,7 +61,7 @@ bool module::session::check() void module::session::regist(sol::state* lua) { - lua->new_usertype("module_session", + lua->new_usertype("fw_session", "check", &module::session::check, "get", &module::session::get, "id", &module::session::id, diff --git a/src/module/http/subscribe.cpp b/src/module/http/subscribe.cpp index 488776d..6dc2140 100644 --- a/src/module/http/subscribe.cpp +++ b/src/module/http/subscribe.cpp @@ -52,7 +52,7 @@ void module::subscribe::clear(sol::this_state ts) void module::subscribe::regist(sol::state* lua) { - lua->new_usertype("subscribe", + lua->new_usertype("fw_subscribe", "add", &module::subscribe::add, "remove", &module::subscribe::remove, "exist", &module::subscribe::exist, diff --git a/src/module/ini.cpp b/src/module/ini.cpp index 422bee1..3084c33 100644 --- a/src/module/ini.cpp +++ b/src/module/ini.cpp @@ -103,7 +103,7 @@ sol::table module::ini::table(sol::this_state s) void module::ini::regist(sol::state* lua) { - lua->new_usertype("ini", + lua->new_usertype("fw_ini", "new", sol::constructors(), "close", &module::ini::close, "del", &module::ini::del, diff --git a/src/module/mutex.cpp b/src/module/mutex.cpp index fa17aea..eb25038 100644 --- a/src/module/mutex.cpp +++ b/src/module/mutex.cpp @@ -42,7 +42,7 @@ bool module::mutex::try_lock() void module::mutex::regist(sol::state* lua) { - lua->new_usertype("mutex", + lua->new_usertype("fw_mutex", "new", sol::constructors(), "lock", &module::mutex::lock, "unlock", &module::mutex::unlock, diff --git a/src/module/process.cpp b/src/module/process.cpp index c34ecd6..5f9111f 100644 --- a/src/module/process.cpp +++ b/src/module/process.cpp @@ -94,7 +94,7 @@ std::string module::process::getpath(size_t pid) void module::process::regist(sol::state* lua) { - lua->new_usertype("process", + lua->new_usertype("fw_process", "create", &module::process::create, "destory", &module::process::destory, "exist", &module::process::exist, diff --git a/src/module/sys.cpp b/src/module/sys.cpp index 52f25c7..08cca3f 100644 --- a/src/module/sys.cpp +++ b/src/module/sys.cpp @@ -24,7 +24,7 @@ void module::sys::sleep_msec(uint32 msec) void module::sys::regist(sol::state* lua) { - lua->new_usertype("sys", + lua->new_usertype("fw_sys", "sleep_msec", &module::sys::sleep_msec ); diff --git a/src/module/timer.cpp b/src/module/timer.cpp index d8419f4..bf209ea 100644 --- a/src/module/timer.cpp +++ b/src/module/timer.cpp @@ -64,7 +64,7 @@ void module::timer::remove(const std::string& name, sol::this_state ts) } void module::timer::regist(sol::state* lua) { - lua->new_usertype("timer", + lua->new_usertype("fw_timer", "new", sol::constructors(), "add", &module::timer::add, "remove", &module::timer::remove,