15 #ifndef SCRIPTING_LUA_KERNEL_BASE_HPP
16 #define SCRIPTING_LUA_KERNEL_BASE_HPP
22 #include <boost/cstdint.hpp>
37 void run(
char const *prog,
int nArgs = 0);
56 virtual void log_error(
char const*
msg,
char const* context =
"Lua error");
82 , external_log_(nullptr)
88 (*external_log_) << str;
97 (*external_log_) << str;
126 bool load_string(
char const * prog, error_handler);
void interactive_run(char const *prog)
Tests if a program resolves to an expression, and pretty prints it if it is, otherwise it runs it nor...
std::function< void(char const *, char const *)> error_handler
command_log & operator<<(const std::string &str)
virtual ~lua_kernel_base()
int intf_show_dialog(lua_State *L)
lua_kernel_base(CVideo *ptr)
static T & get_lua_kernel(lua_State *L)
void throwing_run(char const *prog, int nArgs)
Runs a plain script, but reports errors by throwing lua_error.
int intf_show_lua_console(lua_State *L)
void load_package()
Loads the "package" package into the Lua environment.
bool protected_call(int nArgs, int nRets, error_handler)
bool load_string(char const *prog, error_handler)
void run(char const *prog, int nArgs=0)
Runs a plain script.
int intf_print(lua_State *L)
Replacement print function – instead of printing to std::cout, print to the command log...
void set_video(CVideo *ptr)
std::ostream * external_log_
static std::string flush(std::ostringstream &s)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
virtual void log_error(char const *msg, char const *context="Lua error")
void set_external_log(std::ostream *lg)
virtual boost::uint32_t get_random_seed()
std::vector< std::string > get_global_var_names()
Gets all the global variable names in the Lua environment.
std::vector< std::string > get_attribute_names(const std::string &var_path)
Gets all attribute names of an extended variable name.
const std::stringstream & get_log()
virtual void throw_exception(char const *msg, char const *context="Lua error")
virtual std::string my_name()
int intf_show_message_dialog(lua_State *L)
A config object defines a single node in a WML file, with access to child nodes.
int intf_dofile(lua_State *L)
Loads and executes a Lua file.
GLsizei const GLcharARB ** string
int intf_require(lua_State *L)
Loads and executes a Lua file, if there is no corresponding entry in wesnoth.package.
void run_lua_tag(const config &cfg)
Runs a [lua] tag.
static lua_kernel_base *& get_lua_kernel_base_ptr(lua_State *L)
int intf_show_popup_dialog(lua_State *L)