#include "scripting/lua_kernel_base.hpp"
#include "game_config.hpp"
#include "game_errors.hpp"
#include "gui/core/gui_definition.hpp"
#include "log.hpp"
#include "lua_jailbreak_exception.hpp"
#include "random.hpp"
#include "seed_rng.hpp"
#include "deprecation.hpp"
#include "language.hpp"
#include "scripting/lua_color.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_cpp_function.hpp"
#include "scripting/lua_fileops.hpp"
#include "scripting/lua_formula_bridge.hpp"
#include "scripting/lua_gui2.hpp"
#include "scripting/lua_wml.hpp"
#include "scripting/lua_stringx.hpp"
#include "scripting/lua_map_location_ops.hpp"
#include "scripting/lua_rng.hpp"
#include "scripting/lua_widget.hpp"
#include "scripting/push_check.hpp"
#include "game_version.hpp"
#include "picture.hpp"
#include <functional>
#include "utils/name_generator.hpp"
#include "utils/markov_generator.hpp"
#include "utils/context_free_grammar_generator.hpp"
#include <cstring>
#include <exception>
#include <new>
#include <string>
#include <sstream>
#include <vector>
#include "lua/lauxlib.h"
#include "lua/lua.h"
#include "lua/lualib.h"
Go to the source code of this file.
Macros | |
#define | DBG_LUA LOG_STREAM(debug, log_scripting_lua) |
#define | LOG_LUA LOG_STREAM(info, log_scripting_lua) |
#define | WRN_LUA LOG_STREAM(warn, log_scripting_lua) |
#define | ERR_LUA LOG_STREAM(err, log_scripting_lua) |
Typedefs | |
typedef int(lua_kernel_base::* | member_callback) (lua_State *L) |
Functions | |
static int | intf_compare_versions (lua_State *L) |
Compares 2 version strings - which is newer. More... | |
static int | intf_load (lua_State *L) |
Replacement load function. More... | |
static int | impl_name_generator_call (lua_State *L) |
static int | impl_name_generator_collect (lua_State *L) |
static int | intf_name_generator (lua_State *L) |
static int | intf_random (lua_State *L) |
Returns a random numer, same interface as math.random. More... | |
static int | intf_log (lua_State *L) |
Logs a message Arg 1: (optional) Logger Arg 2: Message. More... | |
static int | intf_deprecated_message (lua_State *L) |
Logs a deprecation message. More... | |
static int | intf_get_image_size (lua_State *L) |
Gets the dimension of an image. More... | |
static int | intf_get_time_stamp (lua_State *L) |
Returns the time stamp, exactly as [set_variable] time=stamp does. More... | |
static int | intf_get_language (lua_State *L) |
template<member_callback method> | |
int | dispatch (lua_State *L) |
Variables | |
static lg::log_domain | log_scripting_lua ("scripting/lua") |
static lg::log_domain | log_user ("scripting/lua/user") |
static const char * | Gen = "name generator" |
static const char * | Interp = "lua interpreter" |
#define DBG_LUA LOG_STREAM(debug, log_scripting_lua) |
Definition at line 65 of file lua_kernel_base.cpp.
Referenced by lua_kernel_base::intf_print(), and lua_kernel_base::intf_require().
#define ERR_LUA LOG_STREAM(err, log_scripting_lua) |
Definition at line 68 of file lua_kernel_base.cpp.
Referenced by lua_kernel_base::log_error().
#define LOG_LUA LOG_STREAM(info, log_scripting_lua) |
Definition at line 66 of file lua_kernel_base.cpp.
Referenced by lua_kernel_base::get_attribute_names(), and lua_kernel_base::intf_print().
#define WRN_LUA LOG_STREAM(warn, log_scripting_lua) |
Definition at line 67 of file lua_kernel_base.cpp.
typedef int(lua_kernel_base::* member_callback) (lua_State *L) |
Definition at line 368 of file lua_kernel_base.cpp.
int dispatch | ( | lua_State * | L | ) |
Definition at line 371 of file lua_kernel_base.cpp.
|
static |
Definition at line 183 of file lua_kernel_base.cpp.
References name_generator::generate(), lua_pushstring(), and lua_touserdata().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 190 of file lua_kernel_base.cpp.
References lua_touserdata(), and name_generator::~name_generator().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Compares 2 version strings - which is newer.
Definition at line 83 of file lua_kernel_base.cpp.
References do_version_check(), lua_pushboolean(), luaL_argerror(), luaL_checkstring, OP_INVALID, and parse_version_op().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Logs a deprecation message.
See deprecation.cpp for details Arg 1: Element to be deprecated. Arg 2: Deprecation level. Arg 3: Version when element may be removed. Arg 4: Additional detail message.
Definition at line 318 of file lua_kernel_base.cpp.
References deprecated_message(), game_config::images::level, lua_error(), lua_isnoneornil, lua_push(), luaL_checkinteger(), luaL_checkstring, luaW_checktstring(), wfl::msg(), REMOVED, version_info::str(), and game_config::wesnoth_version.
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Gets the dimension of an image.
Definition at line 340 of file lua_kernel_base.cpp.
References image::locator::file_exists(), image::get_image(), lua_pushinteger(), luaL_checkstring, and s.
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 359 of file lua_kernel_base.cpp.
References get_language(), and lua_push().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Returns the time stamp, exactly as [set_variable] time=stamp does.
Definition at line 354 of file lua_kernel_base.cpp.
References lua_pushinteger().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Replacement load function.
Mostly the same as regular load, but disallows loading binary chunks due to CVE-2018-1999023.
Definition at line 136 of file lua_kernel_base.cpp.
References lua_insert, lua_isnone, LUA_OK, lua_pop, lua_pushnil(), lua_pushvalue(), lua_setupvalue(), luaL_argerror(), luaL_checkstring, luaL_loadbufferx(), luaL_optstring, and name.
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Logs a message Arg 1: (optional) Logger Arg 2: Message.
Definition at line 292 of file lua_kernel_base.cpp.
References debug, lg::err(), lg::info(), LOG_STREAM, log_user, lua_isstring(), luaL_checkstring, wfl::msg(), and lg::warn().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 197 of file lua_kernel_base.cpp.
References Gen, lua_error(), lua_isstring(), lua_istable, lua_next(), lua_pop, lua_pushnil(), lua_pushstring(), lua_setmetatable(), lua_tostring, LUA_TSTRING, lua_type(), luaL_argerror(), luaL_checkstring, luaL_getmetatable, luaL_optinteger(), utils::parenthetical_split(), utils::split(), and name_generator_invalid_exception::what().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Returns a random numer, same interface as math.random.
Definition at line 260 of file lua_kernel_base.cpp.
References randomness::generator, lua_isnoneornil, lua_isnumber(), lua_push(), luaL_argerror(), and randomness::rng::next_random().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 71 of file lua_kernel_base.cpp.
Referenced by intf_name_generator(), and lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 73 of file lua_kernel_base.cpp.
Referenced by lua_kernel_base::interactive_run(), lua_kernel_base::lua_kernel_base(), and lua_kernel_base::throwing_run().
|
static |
|
static |
Referenced by intf_log().