在C++中为LUA添加PATH路径(搜索路径)
2017-11-10 20:45
323 查看
[cpp] view
plain copy
void LuaAddPath(lua_State *ls, char *name, char *value) {
string v;
lua_getglobal(ls, "package");
lua_getfield(ls, -1, name);
v.append(lua_tostring(ls, -1));
v.append(";");
v.append(value);
lua_pushstring(ls, v.c_str());
lua_setfield(ls, -3, name);
lua_pop(ls, 2);
}
[cpp] view
plain copy
LuaAddPath(m_ls->GetCState(), "path", ".\\lual\\?.lua");
LuaAddPath(m_ls->GetCState(), "cpath", ".\\lual\\?.dll");
plain copy
void LuaAddPath(lua_State *ls, char *name, char *value) {
string v;
lua_getglobal(ls, "package");
lua_getfield(ls, -1, name);
v.append(lua_tostring(ls, -1));
v.append(";");
v.append(value);
lua_pushstring(ls, v.c_str());
lua_setfield(ls, -3, name);
lua_pop(ls, 2);
}
[cpp] view
plain copy
LuaAddPath(m_ls->GetCState(), "path", ".\\lual\\?.lua");
LuaAddPath(m_ls->GetCState(), "cpath", ".\\lual\\?.dll");
相关文章推荐
- 在C++中为LUA添加PATH路径(搜索路径)
- 【Python】sys.path.append动态添加搜索路径设置
- Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径
- Python3基础 sys.path.append 增加模块的搜索路径,在主代码处新建一个存放模块的文件夹并将其路径添加到sys.path中
- Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径
- LINUX-添加和修改文件搜索路径PATH变量
- Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径
- Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径
- 为setup.py添加c:c++ 头文件或者库的搜索路径
- Python Import机制备忘-模块搜索路径(sys.path)、嵌套Import、package Import(转)
- 在PATH路径中添加新的路径
- 【C++学习笔记】返回桌面等特系统殊路径地址 —> SHGetSpecialFolderPath
- 添加文件【COCOS2DX-LUA 脚本开发之十三】解决lua项目编译Android出现get data from file failed、Cocos2dxActivity cannot be 路径等问题
- C/C++ 头文件以及库的搜索路径
- Ubuntu 添加Android SDK及NDK路径到PATH
- NSIS 向path添加应用程序安装路径
- Visual C++ Windows 用来定位 DLL 的搜索路径
- Python Import机制备忘-模块搜索路径(sys.path)、嵌套Import、package Import
- (转)为Python添加默认模块搜索路径
- Python Import机制备忘-模块搜索路径(sys.path)、嵌套Import、package Import