#ifndef LUA_WRAPER_H #define LUA_WRAPER_H #include #include #include #include #include extern "C" { #include "lua.h" #include "lauxlib.h" #include "lualib.h" } #include "lua_bind.h" class LuaDelegate{ public: LuaDelegate(); int DoFile(QString); void Stop(); int DoString(QString); void pushstack() { // const std::type_info &t1 = std::bad_typeid(arg1); // std::cout << t1.name() << std::endl; } //单参数模板 template void pushstack(T arg1,Types... rest) { const std::type_info &t1 = typeid(arg1); qDebug() <//类的成员函数是模板 void CallFuntion(QString name,T... para){ int i = lua_getglobal(mVM,name.toStdString().c_str()); if(i < 0){ return ; } pushstack(para...); } /* 收到数据发送给lua层进行处理*/ void OnDataRecv(QString); void DumpStack(); ~LuaDelegate(); private: lua_State *mVM; QString mFile; }; void TestLua(); #endif // LUA_WRAPER_H