The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
application_lua_kernel.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2014 - 2025
3 by Chris Beck <render787@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
21
22#include <string>
23#include <vector>
24
25struct lua_State;
26
28public:
30
31 virtual std::string my_name() { return "Application Lua Kernel"; }
32
33 typedef std::vector<std::function<bool(void)>> request_list;
34
35 class thread {
37 lua_State * T_;
39
40 thread(const thread&) = delete;
41 thread& operator=(const thread&) = delete;
42
43 thread(application_lua_kernel&, lua_State *);
44 public :
45 bool is_running();
46 std::string status();
47
48 request_list run_script(const plugins_context & ctxt, const std::vector<plugins_manager::event> & queue);
49
51 };
52
53 thread * load_script_from_string(const std::string &); //throws
54 thread * load_script_from_file(const std::string &); //throws
55};
request_list run_script(const plugins_context &ctxt, const std::vector< plugins_manager::event > &queue)
thread(const thread &)=delete
thread & operator=(const thread &)=delete
thread * load_script_from_string(const std::string &)
std::vector< std::function< bool(void)> > request_list
virtual std::string my_name()
User-visible name of the lua kernel that they are talking to.
thread * load_script_from_file(const std::string &)