no message
parent
797ee134fa
commit
4d59f92262
|
@ -32,6 +32,7 @@ set(SOURCES # 待预编译的cpp代码
|
|||
globalvar.cpp
|
||||
sharedata.cpp
|
||||
lua_wraper.cpp
|
||||
lua_bind.cpp
|
||||
)
|
||||
|
||||
set(RESOURCES
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -22,8 +22,6 @@ void LuaDelegate::OnDataRecv(){
|
|||
lua_pushstring(mVM,"test");
|
||||
lua_pushnumber(mVM,1);
|
||||
lua_call(mVM,2,0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
LuaDelegate::~LuaDelegate()
|
||||
|
@ -33,6 +31,8 @@ LuaDelegate::~LuaDelegate()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
LuaDelegate::LuaDelegate():
|
||||
mVM(nullptr)
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ int LuaDelegate::DoFile(QString path)
|
|||
{
|
||||
if(mVM != nullptr){
|
||||
luaL_openlibs(mVM); //打开标准库
|
||||
|
||||
int ret = luaL_dofile(mVM, path.toStdString().c_str());
|
||||
if (ret > 0){
|
||||
printf("lua error");
|
||||
|
|
Loading…
Reference in New Issue