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