Files
pip/libs/main/lua/piluaprogram.h

83 lines
3.4 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.
//! \addtogroup Lua
//! \{
//! \file piluaprogram.h
//! \brief
//! \~english Lua Program wrapper
//! \~russian Обёртка программы Lua
//! \details
//! \~english Provides interface for loading and executing Lua scripts using LuaBridge
//! \~russian Предоставляет интерфейс для загрузки и выполнения скриптов Lua с использованием LuaBridge
//! \}
/*
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"
//! \~english Lua Program class provides interface for loading and executing Lua scripts
//! \~russian Класс PILuaProgram предоставляет интерфейс для загрузки и выполнения скриптов Lua
class PIP_LUA_EXPORT PILuaProgram {
public:
//! \~english Constructs an empty PILuaProgram and initializes Lua context
//! \~russian Создаёт пустой PILuaProgram и инициализирует контекст Lua
PILuaProgram();
//! \~english Loads Lua script from PIString
//! \~russian Загружает скрипт Lua из PIString
//! \param script
//! \~english The Lua script to load
//! \~russian Загружаемый скрипт Lua
//! \return
//! \~english true if script loaded successfully
//! \~russian true, если скрипт успешно загружен
bool load(const PIString & script);
//! \~english Prepares the loaded script for execution
//! \~russian Подготавливает загруженный скрипт к выполнению
//! \return
//! \~english true if preparation successful
//! \~russian true, если подготовка успешна
bool prepare();
//! \~english Gets a global Lua object or function by name
//! \~russian Получает глобальный объект или функцию Lua по имени
//! \param name
//! \~english Name of the global object or function
//! \~russian Имя глобального объекта или функции
//! \return
//! \~english LuaRef to the global object or function
//! \~russian LuaRef на глобальный объект или функцию
luabridge::LuaRef getGlobal(const PIString & name);
//! \~english Returns the global namespace of the Lua state
//! \~russian Возвращает глобальное пространство имён состояния Lua
//! \return
//! \~english Namespace object representing global scope
//! \~russian Объект Namespace, представляющий глобальную область видимости
luabridge::Namespace getGlobalNamespace();
private:
PRIVATE_DECLARATION(PIP_LUA_EXPORT)
};
#endif // PILUAPROGRAM_H