I want to integrate LuaSockets in cocos2dx.
I find a blog for this subject on:
http://dualface.qeeplay.com/?paged=2
but after I do everything follow the blog, vs2010 show error when I compile hellolua:
LuaEngineImpl.cpp
d:2d-x\lua\cocos2dx_support\luaengineimpl.cpp(30): fatal error C1083: 无法打开包括文件:“lualoadexts.h”: No such file or directory
and I add the exts path, It show error:
LuaEngineImpl.cpp
LuaEngineImpl.obj : error LNK2019: 无法解析的外部符号 _luax_initpreload,该符号在函数 “public: __thiscall CCLuaScriptModule::CCLuaScriptModule(void)” (??0CCLuaScriptModule@QAE
XZ) 中被引用
I already add #include “lualoadexts.h” in extern “C” section.
Last I search the subject http://www.cocos2d-x.org/boards/11/topics/6348, but not exist
https://github.com/dualface/cocos2d-x/tree/master/lua/exts
please help me.
lualoadexts.h 是自己创建的文件,内容大概如下:
#ifndef __LUALOADEXTS_H_
#define __LUALOADEXTS_H_
#include "lauxlib.h"
void luax_loadexts(lua_State *L);
#endif // __LUALOADEXTS_H_
lualoadexts.c
#include "lualoadexts.h"
// luasocket
#include "luasocket.h"
#include "mime.h"
#include "luasocketscripts.h"
// cjson
#include "lua_cjson.h"
static luaL_Reg luax_exts[] = {
{"socket.core", luaopen_socket_core},
{"mime.core", luaopen_mime_core},
{"socket", luaopen_socket},
{"socket.smtp", luaopen_socket_smtp},
{"socket.http", luaopen_socket_http},
{"socket.ftp", luaopen_socket_ftp},
{"socket.tp", luaopen_socket_tp},
{"socket.url", luaopen_socket_url},
{"mime", luaopen_socket_mime},
{"ltn12", luaopen_socket_ltn12},
{"cjson", luaopen_cjson},
{NULL, NULL}
};
void luax_loadexts(lua_State *L)
{
luaL_Reg* lib = luax_exts;
luaL_findtable(L, LUA_GLOBALSINDEX, "package.preload", sizeof(luax_exts)/sizeof(luax_exts[0])-1);
for (; lib->func; lib++) {
lua_pushstring(L, lib->name);
lua_pushcfunction(L, lib->func);
lua_rawset(L, -3);
}
lua_pop(L, 1);
}
now, the cocos2d-x update to ver0.12, not found libs/lua/cocos2dx_support/LuaEngineImpl.cpp,
may you import luasocket to the new version and update the wiki of this lesson?