scripting/lua.hpp

Go to the documentation of this file.
00001 /* $Id: lua.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2009 - 2012 by Guillaume Melquiond <guillaume.melquiond@gmail.com>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
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 } // of namespace ai
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     /** Runs a plain script. */
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Sat Feb 4 2012 01:03:27 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs