Files
pip/libs/main/lua/piluaprogram.h
2026-03-12 14:46:57 +03:00

65 lines
2.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! \~\file piluaprogram.h
//! \~\ingroup Lua
//! \~\brief
//! \~english Lua Program
//! \~russian Программа Lua
/*
PIP - Platform Independent Primitives
PILuaProgram
Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PILUAPROGRAM_H
#define PILUAPROGRAM_H
#include "pip_lua.h"
#include "pip_lua_export.h"
//! \~\ingroup Lua
//! \~\brief
//! \~english Helper object for loading scripts and exposing the embedded Lua state through LuaBridge.
//! \~russian Вспомогательный объект для загрузки скриптов и доступа к встроенному состоянию Lua через LuaBridge.
//! \details
//! \~english Provides interface for loading and executing Lua scripts using LuaBridge
//! \~russian Предоставляет интерфейс для загрузки и выполнения скриптов Lua с использованием LuaBridge
class PIP_LUA_EXPORT PILuaProgram {
public:
//! \~english Constructs a Lua program object and opens the standard Lua libraries.
//! \~russian Создает объект Lua-программы и открывает стандартные библиотеки Lua.
PILuaProgram();
//! \~english Loads and executes Lua source code from \a script.
//! \~russian Загружает и выполняет исходный код Lua из \a script.
bool load(const PIString & script);
//! \~english Calls \c lua_pcall() for the current Lua stack state.
//! \~russian Вызывает \c lua_pcall() для текущего состояния стека Lua.
bool prepare();
//! \~english Returns a global Lua value by name.
//! \~russian Возвращает глобальное значение Lua по имени.
luabridge::LuaRef getGlobal(const PIString & name);
//! \~english Returns the LuaBridge namespace bound to the global Lua table.
//! \~russian Возвращает пространство имен LuaBridge, связанное с глобальной таблицей Lua.
luabridge::Namespace getGlobalNamespace();
private:
PRIVATE_DECLARATION(PIP_LUA_EXPORT)
};
#endif // PILUAPROGRAM_H