1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 09:39:42 +00:00

Make r, g, b, a read-only properties, rather than getters

This commit is contained in:
uramer 2022-09-07 21:14:40 +02:00
parent 64d925eace
commit 19d01f26d6

View file

@ -115,10 +115,10 @@ namespace LuaUtil
// Lua bindings for Color // Lua bindings for Color
sol::usertype<Misc::Color> colorType = lua.new_usertype<Misc::Color>("Color"); sol::usertype<Misc::Color> colorType = lua.new_usertype<Misc::Color>("Color");
colorType["r"] = [](const Misc::Color& c) { return c.r(); }; colorType["r"] = sol::readonly_property([](const Misc::Color& c) { return c.r(); });
colorType["g"] = [](const Misc::Color& c) { return c.g(); }; colorType["g"] = sol::readonly_property([](const Misc::Color& c) { return c.g(); });
colorType["b"] = [](const Misc::Color& c) { return c.b(); }; colorType["b"] = sol::readonly_property([](const Misc::Color& c) { return c.b(); });
colorType["a"] = [](const Misc::Color& c) { return c.a(); }; 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[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["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()); }; colorType["asRgb"] = [](const Misc::Color& c) { return Vec3(c.r(), c.g(), c.b()); };