64,654
社区成员
发帖
与我相关
我的任务
分享
m_pAcceptor->async_accept( *pSocket, boost::bind(&CServer::acceptHandler, this,
pSocket, iIndex, boost::asio::placeholders::error) );
void CServer::acceptHandler(tcp::socket *pSocket, int iIndex, error_code ec);
local server = CServer:new(bind_port);
function server:acceptHandler(socket, index, err)
print("--->> on_connect, index:", index);
end
server:start()
server:run();
function server:acceptHandler(socket, index, err)
print("--->> on_connect, index:", index);
end
int luaopen_Engine(lua_State* tolua_S);//这个就是用tolua将c++封装后的可给lua调用的接口。
int main(int argc, char* argv[])
{
cout << " ====== main in c++ ====== " << endl;
lua_State* L = lua_open();
luaopen_base(L);
luaopen_Engine(L);
string strLuaFile;
if (argc == 2)
{
strLuaFile = argv[1];
}
else
{
strLuaFile = "start.lua";
}
if ( luaL_loadfile(L, strLuaFile.c_str()) || lua_pcall(L, 0, 0, 0) )
{
{
const char * error = lua_tostring(L, -1) ;
cout << string(error) << endl;
}
}
cout << "in c++ exit!" << endl;
return 0;
}