Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef SCRIPTING_LUA_HPP
00017 #define SCRIPTING_LUA_HPP
00018
00019 #include "game_events.hpp"
00020
00021 struct lua_State;
00022
00023 namespace ai {
00024 class lua_ai_action_handler;
00025 class lua_ai_context;
00026 class engine_lua;
00027 }
00028
00029 void extract_preload_scripts(config const &);
00030
00031 class LuaKernel
00032 {
00033 lua_State *mState;
00034 const config &level_;
00035 bool execute(char const *, int, int);
00036 public:
00037 LuaKernel(const config &);
00038 ~LuaKernel();
00039 void initialize();
00040 void save_game(config &);
00041 void load_game();
00042 bool run_event(game_events::queued_event const &);
00043 void set_wml_action(std::string const &, game_events::action_handler);
00044 bool run_wml_action(std::string const &, vconfig const &,
00045 game_events::queued_event const &);
00046 bool run_filter(char const *name, unit const &u);
00047
00048 void run(char const *prog) { execute(prog, 0, 0); }
00049 ai::lua_ai_context* create_lua_ai_context(char const *code, ai::engine_lua *engine);
00050 ai::lua_ai_action_handler* create_lua_ai_action_handler(char const *code, ai::lua_ai_context &context);
00051 void load_package();
00052 };
00053
00054 #endif