Skip to content

Commit abb9dfb

Browse files
authored
lua copy color (#7374)
1 parent 243dc92 commit abb9dfb

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

code/scripting/api/objs/color.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,19 @@ ADE_VIRTVAR(Alpha,
6969
return colorVarHelper(L, &color::alpha);
7070
}
7171

72+
ADE_FUNC(copy,
73+
l_Color,
74+
nullptr,
75+
"Returns a copy of the color",
76+
"color",
77+
"The copy, or null color on failure")
78+
{
79+
color* clr = nullptr;
80+
if (!ade_get_args(L, "o", l_Color.GetPtr(&clr)))
81+
return ade_set_error(L, "o", l_Color.Set(color()));
82+
83+
return ade_set_args(L, "o", l_Color.Set(*clr));
84+
}
85+
7286
} // namespace api
7387
} // namespace scripting

0 commit comments

Comments
 (0)