The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
lua_unit_type.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2014 - 2025
3 by Chris Beck <render787@gmail.com>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
18struct lua_State;
19class unit_type;
20
21#include <string>
22
23/**
24 * This namespace contains bindings for lua to hold a reference to a
25 * unit type and access its stats.
26 */
27namespace lua_unit_type {
28 std::string register_metatable(lua_State *);
29 std::string register_table(lua_State *);
30} //end namespace lua_team
31
32/**
33 * Create a lua object containing a reference to a unittype, and a
34 * metatable to access the properties.
35 */
36void luaW_pushunittype(lua_State *, const unit_type&);
37
38/** Test if a stack element is a unit type, and return it if so */
39const unit_type* luaW_tounittype(lua_State*, int);
40
41/** Test if a stack element is a unit type, and return it if so */
42const unit_type& luaW_checkunittype(lua_State*, int);
A single unit type that the player may recruit.
Definition types.hpp:43
const unit_type & luaW_checkunittype(lua_State *, int)
Test if a stack element is a unit type, and return it if so.
void luaW_pushunittype(lua_State *, const unit_type &)
Create a lua object containing a reference to a unittype, and a metatable to access the properties.
const unit_type * luaW_tounittype(lua_State *, int)
Test if a stack element is a unit type, and return it if so.
This namespace contains bindings for lua to hold a reference to a unit type and access its stats.
std::string register_metatable(lua_State *L)
std::string register_table(lua_State *L)