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 17 struct lua_State; 18 class unit_type; 19 20 #include <string> 21 22 /** 23 * This namespace contains bindings for lua to hold a reference to a 24 * unit type and access its stats. 25 */ 26 namespace lua_unit_type { 27 std::string register_metatable(lua_State *); 28 std::string register_table(lua_State *); 29 } //end namespace lua_team 30 31 /// Create a lua object containing a reference to a unittype, and a 32 /// metatable to access the properties. 33 void luaW_pushunittype(lua_State *, const unit_type&); 34 35 /// Test if a stack element is a unit type, and return it if so 36 const unit_type* luaW_tounittype(lua_State*, int); 37 38 /// Test if a stack element is a unit type, and return it if so 39 const unit_type& luaW_checkunittype(lua_State*, int); 40