From ce904848984ef8c7805bcf0bdeb481ca0a902504 Mon Sep 17 00:00:00 2001 From: psi29a Date: Wed, 7 Sep 2022 21:02:32 +0000 Subject: [PATCH] Merge branch 'fix_lua_color' into 'openmw-48' Make r, g, b, a read-only properties, rather than getters See merge request OpenMW/openmw!2380 (cherry picked from commit 85f343e87a3fabe52820daffe0346bf9ada9548b) 19d01f26 Make r, g, b, a read-only properties, rather than getters --- components/lua/utilpackage.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/lua/utilpackage.cpp b/components/lua/utilpackage.cpp index 147738ca8e..88cf7cb17a 100644 --- a/components/lua/utilpackage.cpp +++ b/components/lua/utilpackage.cpp @@ -115,10 +115,10 @@ namespace LuaUtil // Lua bindings for Color sol::usertype colorType = lua.new_usertype("Color"); - colorType["r"] = [](const Misc::Color& c) { return c.r(); }; - colorType["g"] = [](const Misc::Color& c) { return c.g(); }; - colorType["b"] = [](const Misc::Color& c) { return c.b(); }; - colorType["a"] = [](const Misc::Color& c) { return c.a(); }; + colorType["r"] = sol::readonly_property([](const Misc::Color& c) { return c.r(); }); + colorType["g"] = sol::readonly_property([](const Misc::Color& c) { return c.g(); }); + colorType["b"] = sol::readonly_property([](const Misc::Color& c) { return c.b(); }); + colorType["a"] = sol::readonly_property([](const Misc::Color& c) { return c.a(); }); colorType[sol::meta_function::to_string] = [](const Misc::Color& c) { return c.toString(); }; colorType["asRgba"] = [](const Misc::Color& c) { return Vec4(c.r(), c.g(), c.b(), c.a()); }; colorType["asRgb"] = [](const Misc::Color& c) { return Vec3(c.r(), c.g(), c.b()); };