aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/misc_helpers.lua
diff options
context:
space:
mode:
authorGael-de-Sailly <gael.chretien@akeonet.com>2015-02-27 20:51:55 +0100
committerparamat <mat.gregory@virginmedia.com>2017-06-22 03:11:50 +0100
commitbc53c82bcf923d11725e3de8565eb4c7e435cd2b (patch)
tree9766b64f87b569033291ebb799c26d68512c074c /builtin/common/misc_helpers.lua
parent1425c6def156840b359b90b4f32b9c7b8f005731 (diff)
downloadminetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.tar.gz
minetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.tar.bz2
minetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.zip
Add minetest.rgba function that returns ColorString from RGBA or RGB values
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r--builtin/common/misc_helpers.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index f9b572d9f..776be29d8 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -512,6 +512,12 @@ function core.explode_scrollbar_event(evt)
end
--------------------------------------------------------------------------------
+function core.rgba(r, g, b, a)
+ return a and string.format("#%02X%02X%02X%02X", r, g, b, a) or
+ string.format("#%02X%02X%02X", r, g, b)
+end
+
+--------------------------------------------------------------------------------
function core.pos_to_string(pos, decimal_places)
local x = pos.x
local y = pos.y