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_API_HPP
00017 #define SCRIPTING_LUA_API_HPP
00018
00019 #include <cstddef>
00020
00021 struct lua_State;
00022 class config;
00023 class vconfig;
00024 class unit;
00025
00026 bool luaW_pcall(lua_State *L , int nArgs, int nRets, bool allow_wml_error = false);
00027 unit *luaW_tounit(lua_State *L, int index, bool only_on_map = false);
00028 void luaW_pushconfig(lua_State *L, config const &cfg);
00029 bool luaW_toconfig(lua_State *L, int index, config &cfg, int tstring_meta = 0);
00030 bool luaW_tovconfig(lua_State *L, int index, vconfig &vcfg);
00031
00032
00033
00034
00035
00036
00037 class lua_unit
00038 {
00039 size_t uid;
00040 unit *ptr;
00041 int side;
00042 lua_unit(lua_unit const &);
00043
00044 public:
00045 lua_unit(size_t u): uid(u), ptr(NULL), side(0) {}
00046 lua_unit(unit *u): uid(0), ptr(u), side(0) {}
00047 lua_unit(int s, size_t u): uid(u), ptr(NULL), side(s) {}
00048 ~lua_unit();
00049 bool on_map() const { return !ptr && side == 0; }
00050 int on_recall_list() const { return side; }
00051 unit *get();
00052 };
00053
00054 #endif