The Battle for Wesnoth  1.19.5+dev
application_lua_kernel.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2024
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 
25 struct lua_State;
26 
28 public:
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 {
36  lua_State * T_;
37  bool started_;
38 
39  thread(const thread&) = delete;
40  thread& operator=(const thread&) = delete;
41 
42  thread(lua_State *);
43  public :
44  bool is_running();
45  std::string status();
46 
47  request_list run_script(const plugins_context & ctxt, const std::vector<plugins_manager::event> & queue);
48 
49  friend class application_lua_kernel;
50  };
51 
52  thread * load_script_from_string(const std::string &); //throws
53  thread * load_script_from_file(const std::string &); //throws
54 };
thread & operator=(const thread &)=delete
request_list run_script(const plugins_context &ctxt, const std::vector< plugins_manager::event > &queue)
thread(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 &)