The Battle for Wesnoth  1.19.1+dev
Namespaces | Macros | Functions | Variables
lua_color.cpp File Reference
#include "color_range.hpp"
#include "scripting/lua_color.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/push_check.hpp"
#include "log.hpp"
#include "game_config.hpp"
Include dependency graph for lua_color.cpp:

Go to the source code of this file.

Namespaces

 lua_colors
 

Macros

#define LOG_LUA   LOG_STREAM(info, log_scripting_lua)
 
#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)
 

Functions

static bool luaW_iscolor (lua_State *L, int index)
 
static color_rangeLuaW_checkcolor (lua_State *L, int index)
 
static color_rangeluaW_pushcolor (lua_State *L, const color_range &color)
 
static int luaW_pushsinglecolor (lua_State *L, const color_t &color)
 
static int impl_color_collect (lua_State *L)
 
static int impl_color_equality (lua_State *L)
 Checks two color units for equality. More...
 
static int impl_color_tostring (lua_State *L)
 Turns a lua color to string. More...
 
static int impl_get_color (lua_State *L)
 
static int impl_color_get (lua_State *L)
 
static int impl_color_dir (lua_State *L)
 
static int impl_color_set (lua_State *L)
 
static int impl_colors_table_dir (lua_State *L)
 
std::string lua_colors::register_metatables (lua_State *L)
 

Variables

static lg::log_domain log_scripting_lua ("scripting/lua")
 
static const char colorKey [] = "color range"
 

Macro Definition Documentation

◆ ERR_LUA

#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)

Definition at line 24 of file lua_color.cpp.

◆ LOG_LUA

#define LOG_LUA   LOG_STREAM(info, log_scripting_lua)

Definition at line 23 of file lua_color.cpp.

Function Documentation

◆ impl_color_collect()

static int impl_color_collect ( lua_State *  L)
static

Definition at line 60 of file lua_color.cpp.

References c.

Referenced by lua_colors::register_metatables().

◆ impl_color_dir()

static int impl_color_dir ( lua_State *  L)
static

Definition at line 128 of file lua_color.cpp.

References lua_push().

Referenced by lua_colors::register_metatables().

◆ impl_color_equality()

static int impl_color_equality ( lua_State *  L)
static

Checks two color units for equality.

(__eq metamethod)

Definition at line 70 of file lua_color.cpp.

References LuaW_checkcolor().

Referenced by lua_colors::register_metatables().

◆ impl_color_get()

static int impl_color_get ( lua_State *  L)
static

Definition at line 103 of file lua_color.cpp.

References c, lua_push(), LuaW_checkcolor(), and luaW_pushsinglecolor().

Referenced by lua_colors::register_metatables().

◆ impl_color_set()

static int impl_color_set ( lua_State *  L)
static

Definition at line 135 of file lua_color.cpp.

Referenced by lua_colors::register_metatables().

◆ impl_color_tostring()

static int impl_color_tostring ( lua_State *  L)
static

Turns a lua color to string.

(__tostring metamethod)

Definition at line 82 of file lua_color.cpp.

References c, lua_push(), and LuaW_checkcolor().

Referenced by lua_colors::register_metatables().

◆ impl_colors_table_dir()

static int impl_colors_table_dir ( lua_State *  L)
static

Definition at line 140 of file lua_color.cpp.

References lua_push(), and game_config::team_rgb_range.

Referenced by lua_colors::register_metatables().

◆ impl_get_color()

static int impl_get_color ( lua_State *  L)
static
  • Arg 1: userdata (ignored).
  • Arg 2: string containing the name of the color.
  • Ret 1: color_range containing the color.

Definition at line 96 of file lua_color.cpp.

References game_config::color_info(), and luaW_pushcolor().

Referenced by lua_colors::register_metatables().

◆ LuaW_checkcolor()

static color_range& LuaW_checkcolor ( lua_State *  L,
int  index 
)
static

◆ luaW_iscolor()

static bool luaW_iscolor ( lua_State *  L,
int  index 
)
static

Definition at line 28 of file lua_color.cpp.

References colorKey, and utf8::index().

Referenced by LuaW_checkcolor().

◆ luaW_pushcolor()

static color_range* luaW_pushcolor ( lua_State *  L,
const color_range color 
)
static

Definition at line 43 of file lua_color.cpp.

References colorKey.

Referenced by impl_get_color().

◆ luaW_pushsinglecolor()

static int luaW_pushsinglecolor ( lua_State *  L,
const color_t color 
)
static

Definition at line 50 of file lua_color.cpp.

References luaW_table_set().

Referenced by impl_color_get().

Variable Documentation

◆ colorKey

const char colorKey[] = "color range"
static

Definition at line 26 of file lua_color.cpp.

Referenced by luaW_iscolor(), luaW_pushcolor(), and lua_colors::register_metatables().

◆ log_scripting_lua

lg::log_domain log_scripting_lua("scripting/lua") ( "scripting/lua"  )
static