no message

master
zcy 2021-04-16 01:13:04 +08:00
parent 797ee134fa
commit 4d59f92262
5 changed files with 31 additions and 1097 deletions

View File

@ -32,6 +32,7 @@ set(SOURCES # 待预编译的cpp代码
globalvar.cpp globalvar.cpp
sharedata.cpp sharedata.cpp
lua_wraper.cpp lua_wraper.cpp
lua_bind.cpp
) )
set(RESOURCES set(RESOURCES

File diff suppressed because it is too large Load Diff

14
protoDebuger/lua_bind.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "lua_bind.h"
int LuaShowData(lua_State *vm)
{
// 获取函数参数:从栈底取一个参数
const char *k = lua_tostring(vm, 1);
if (nullptr != k){
//todo qml显示添加
}
return 0;
}

13
protoDebuger/lua_bind.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef LUA_BIND_H
#define LUA_BIND_H
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
int LuaShowData(lua_State *);
#endif // LUA_BIND_H

View File

@ -22,8 +22,6 @@ void LuaDelegate::OnDataRecv(){
lua_pushstring(mVM,"test"); lua_pushstring(mVM,"test");
lua_pushnumber(mVM,1); lua_pushnumber(mVM,1);
lua_call(mVM,2,0); lua_call(mVM,2,0);
} }
LuaDelegate::~LuaDelegate() LuaDelegate::~LuaDelegate()
@ -33,6 +31,8 @@ LuaDelegate::~LuaDelegate()
} }
} }
LuaDelegate::LuaDelegate(): LuaDelegate::LuaDelegate():
mVM(nullptr) mVM(nullptr)
{ {
@ -46,6 +46,7 @@ int LuaDelegate::DoFile(QString path)
{ {
if(mVM != nullptr){ if(mVM != nullptr){
luaL_openlibs(mVM); //打开标准库 luaL_openlibs(mVM); //打开标准库
int ret = luaL_dofile(mVM, path.toStdString().c_str()); int ret = luaL_dofile(mVM, path.toStdString().c_str());
if (ret > 0){ if (ret > 0){
printf("lua error"); printf("lua error");