The Battle for Wesnoth  1.15.3+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 "lua/lauxlib.h"
#include "lua/lua.h"
#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

bool luaW_iscolor (lua_State *L, int index)
 
static color_rangeLuaW_checkcolor (lua_State *L, int index)
 
color_rangeluaW_pushcolor (lua_State *L, const color_range &color)
 
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_set (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 25 of file lua_color.cpp.

◆ LOG_LUA

#define LOG_LUA   LOG_STREAM(info, log_scripting_lua)

Definition at line 24 of file lua_color.cpp.

Function Documentation

◆ impl_color_collect()

static int impl_color_collect ( lua_State L)
static

Definition at line 61 of file lua_color.cpp.

References c, and lua_touserdata().

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 71 of file lua_color.cpp.

References left, lua_pushboolean(), LuaW_checkcolor(), and right.

Referenced by lua_colors::register_metatables().

◆ impl_color_get()

static int impl_color_get ( lua_State L)
static

◆ impl_color_set()

static int impl_color_set ( lua_State L)
static

Definition at line 129 of file lua_color.cpp.

References luaL_argerror().

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 83 of file lua_color.cpp.

References c, color_range::debug(), lua_push(), and LuaW_checkcolor().

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 97 of file lua_color.cpp.

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

Referenced by lua_colors::register_metatables().

◆ LuaW_checkcolor()

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

◆ luaW_iscolor()

bool luaW_iscolor ( lua_State L,
int  index 
)

Definition at line 29 of file lua_color.cpp.

References colorKey, and luaL_testudata().

Referenced by LuaW_checkcolor().

◆ luaW_pushcolor()

color_range* luaW_pushcolor ( lua_State L,
const color_range color 
)

Definition at line 44 of file lua_color.cpp.

References colorKey, and luaL_setmetatable().

Referenced by impl_get_color().

◆ luaW_pushsinglecolor()

int luaW_pushsinglecolor ( lua_State L,
const color_t color 
)

Definition at line 51 of file lua_color.cpp.

References color_t::a, color_t::b, color_t::g, lua_createtable(), luaW_table_set(), and color_t::r.

Referenced by impl_color_get().

Variable Documentation

◆ colorKey

const char colorKey[] = "color range"
static

Definition at line 27 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")
static