void LuaLibrary::VLoadCoreModule( const unsigned int selectedModule) { CoreModules coreModule = static_cast<CoreModules>(selectedModule); switch(coreModule) { case LuaLibrary::CoreModules::Base: luaopen_base(m_pLuaState); break; case LuaLibrary::CoreModules::Debug: luaopen_debug(m_pLuaState); break; case LuaLibrary::CoreModules::Math: luaopen_math(m_pLuaState); break; case LuaLibrary::CoreModules::Os: luaopen_os(m_pLuaState); break; case LuaLibrary::CoreModules::String: luaopen_string(m_pLuaState); break; case LuaLibrary::CoreModules::Table: luaopen_table(m_pLuaState); break; } }
int open_os() { if (L) { luaopen_os(L); return 0; } return -1; }
void ChatLog::initialize_lua(const char* __luafile) { if (m_lua == 0) m_lua = lua_open(); luaopen_base(m_lua); luaopen_string(m_lua); // string.format() luaopen_os(m_lua); // os.data() //luaL_dofile(m_lua, __luafile); luaL_loadfile(m_lua, __luafile); lua_pcall(m_lua, 0, 0, 0); }
LuaScript::LuaScript() { m_LuaState = lua_open(); if( m_LuaState ) { // инициализация стандартных библиотечных функции lua luaopen_base( m_LuaState ); luaopen_table( m_LuaState ); luaopen_string( m_LuaState ); luaopen_math( m_LuaState ); luaopen_os( m_LuaState ); } else Log( "Error Initializing Lua" ); }
//---------------------------------------------------------------------------// // Init // //---------------------------------------------------------------------------// bool CLuaFile::Init(const char *pszFile) { End(); BorraVars(); m_pLuaState = lua_open(); if (m_pLuaState) { m_bOk = true; luaopen_base (m_pLuaState); luaopen_table (m_pLuaState); luaopen_string (m_pLuaState); luaopen_math (m_pLuaState); luaopen_os (m_pLuaState); // Registrar las funiones y procesar el fichero #define ITEM(funcname,func) lua_register(m_pLuaState, funcname, func); #include "EnumFuncionesLua.h" #undef ITEM char pBuffer[MAX_PATH]; GetCurrentDirectory(MAX_PATH,pBuffer); strcat_s(pBuffer, "%s\\demo.lua"); if (luaL_loadfile(m_pLuaState, pBuffer) == 0) { if (lua_pcall(m_pLuaState, 0, 0, 0) == 0) { } else { GLOG(("ERR: Error procesando el fichero LUA '%s'", pszFile)); End(); } } else { GLOG(("ERR: Can't load LUA file\n")); End(); } } return (IsOk()); }
bool LuaWrapper::openOS() { luaopen_os(m_luaState); return true; }