Skip to content

Commit ad04c35

Browse files
committed
f
1 parent d1a6965 commit ad04c35

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

bsn_cpp/plug_cmd/src/plug_cmd.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ bool C_PlugCmd::AllInitAfter() {
4848
RegPlugCmd(GetName(), "pwd", boost::bind(&C_PlugCmd::CmdPWD, this, _1, _2));
4949
RegPlugCmd(GetName(), "ReloadPlug", boost::bind(&C_PlugCmd::CmdReloadPlug, this, _1, _2));
5050
RegPlugCmd(GetName(), "help", boost::bind(&C_PlugCmd::CmdHelp, this, _1, _2));
51+
RegPlugCmd(GetName(), "l", boost::bind(&C_PlugCmd::CmdDoLuaString, this, _1, _2));
5152
return true;
5253
}
5354

@@ -75,6 +76,12 @@ void C_PlugCmd::CmdPWD(bool bShowHelp, std::string const& strParam) {
7576
D_OutInfo2("cur plug:", m_pData->m_strCurPlug);
7677
}
7778

79+
void C_PlugCmd::CmdDoLuaString(bool bShowHelp, std::string const& strParam) {
80+
D_OutInfo2(bShowHelp, strParam);
81+
82+
m_spI_PlugMgr->DoLuaString(strParam);
83+
}
84+
7885
void C_PlugCmd::CmdCD(bool bShowHelp, std::string const& strParam) {
7986
D_OutInfo2(bShowHelp, strParam);
8087

bsn_cpp/plug_cmd/src/plug_cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class C_PlugCmd : public I_PlugCmd {
6464
void CmdPopD(bool bShowHelp, std::string const& strParam);
6565
void CmdReloadPlug(bool bShowHelp, std::string const& strParam);
6666
void CmdHelp(bool bShowHelp, std::string const& strParam);
67+
void CmdDoLuaString(bool bShowHelp, std::string const& strParam);
6768

6869
public:
6970
C_PlugCmd(void* pData);

bsn_cpp/plug_mgr/include/i_plug_mgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class I_PlugMgr : public std::enable_shared_from_this<I_PlugMgr> {
3030

3131
virtual T_IOService& GetIOService() = 0;
3232
virtual lua_State* GetLuaState() const = 0;
33+
virtual void DoLuaString(std::string const& strLua) = 0;
3334

3435
public:
3536
T_SPI_PlugMgr GetSPI_PlugMgr() {

bsn_cpp/plug_mgr/src/plug_mgr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ class C_PlugMgr : public I_PlugMgr {
2828

2929
virtual boost::asio::io_service& GetIOService() override;
3030
virtual lua_State* GetLuaState() const override;
31+
virtual void DoLuaString(std::string const& strLua) override;
3132

3233
public:
33-
uint32_t GetFrameMS() const;
34+
uint32_t GetFrameMS() const;
35+
3436

3537
public:
3638
static T_SPC_PlugMgr NewC_PlugMgr();

bsn_cpp/plug_mgr/src/plug_mgr_reg2lua.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,11 @@ void C_PlugMgr::Reg2Lua(lua_State* pLuaState) {
1818
.addData("m_strConfigFile", &C_PlugMgr::m_strConfigFile)
1919
.endClass();
2020
}
21+
22+
void C_PlugMgr::DoLuaString(std::string const& strLua) {
23+
D_OutInfo1(strLua);
24+
25+
luaL_dostring(m_pLuaState, strLua.c_str());
26+
}
2127
//////////////////////////////////////////////////////////////////////
2228
D_BsnNamespace1End

0 commit comments

Comments
 (0)