优化
支持sys模块 支持decimal 增加系统模块
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "module/codec.h"
|
||||
#include "module/time.h"
|
||||
#include "module/file.h"
|
||||
#include "module/sys.h"
|
||||
#define LOOP_STATE_USE 1
|
||||
bool state_manager::start()
|
||||
{
|
||||
@@ -82,6 +83,7 @@ sol::state* state_manager::create_state()
|
||||
module::codec::regist(lua);
|
||||
module::time::regist(lua);
|
||||
module::file::regist(lua);
|
||||
module::sys::regist(lua);
|
||||
|
||||
global::getInstance()->regist_lua(lua);
|
||||
return lua;
|
||||
|
||||
@@ -567,7 +567,11 @@ VarType module::mysql_result::get(sol::object obj, sol::this_state s)
|
||||
{
|
||||
GET_VALUE(get_int64);
|
||||
}
|
||||
return sol::make_object(s, sol::nil);
|
||||
else if (type == "decimal")
|
||||
{
|
||||
GET_VALUE(get_double);
|
||||
}
|
||||
return sol::make_object(s, sol::nil);
|
||||
|
||||
}
|
||||
|
||||
|
||||
12
src/module/sys.cpp
Normal file
12
src/module/sys.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "sys.h"
|
||||
#include "util/system.h"
|
||||
std::string module::sys::current_dir()
|
||||
{
|
||||
return system::current_dir();
|
||||
}
|
||||
void module::sys::regist(sol::state* lua)
|
||||
{
|
||||
lua->new_usertype<module::sys>("sys",
|
||||
"current_dir", &module::sys::current_dir
|
||||
);
|
||||
}
|
||||
17
src/module/sys.h
Normal file
17
src/module/sys.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "sol/sol.hpp"
|
||||
#include "imodule.h"
|
||||
|
||||
namespace module
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统
|
||||
/// </summary>
|
||||
class sys:public module::imodule {
|
||||
public:
|
||||
static std::string current_dir();
|
||||
static void regist(sol::state* lua);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user