forked from Mirrorlandia_minetest/minetest
Add minetest.rgba function that returns ColorString from RGBA or RGB values
This commit is contained in:
parent
1425c6def1
commit
bc53c82bcf
@ -511,6 +511,12 @@ function core.explode_scrollbar_event(evt)
|
|||||||
return retval
|
return retval
|
||||||
end
|
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)
|
function core.pos_to_string(pos, decimal_places)
|
||||||
local x = pos.x
|
local x = pos.x
|
||||||
|
@ -794,6 +794,10 @@ Call these functions only at load time!
|
|||||||
* See documentation on `minetest.compress()` for supported compression methods.
|
* See documentation on `minetest.compress()` for supported compression methods.
|
||||||
* currently supported.
|
* currently supported.
|
||||||
* `...` indicates method-specific arguments. Currently, no methods use this.
|
* `...` indicates method-specific arguments. Currently, no methods use this.
|
||||||
|
* `minetest.rgba(red, green, blue[, alpha])`: returns a string
|
||||||
|
* Each argument is a 8 Bit unsigned integer
|
||||||
|
* Returns the ColorString from rgb or rgba values
|
||||||
|
* Example: `minetest.rgba(10, 20, 30, 40)`, returns `"#0A141E28"`
|
||||||
* `minetest.encode_base64(string)`: returns string encoded in base64
|
* `minetest.encode_base64(string)`: returns string encoded in base64
|
||||||
* Encodes a string in base64.
|
* Encodes a string in base64.
|
||||||
* `minetest.decode_base64(string)`: returns string
|
* `minetest.decode_base64(string)`: returns string
|
||||||
|
@ -2958,6 +2958,10 @@ These functions return the leftover itemstack.
|
|||||||
* See documentation on `minetest.compress()` for supported compression methods.
|
* See documentation on `minetest.compress()` for supported compression methods.
|
||||||
* currently supported.
|
* currently supported.
|
||||||
* `...` indicates method-specific arguments. Currently, no methods use this.
|
* `...` indicates method-specific arguments. Currently, no methods use this.
|
||||||
|
* `minetest.rgba(red, green, blue[, alpha])`: returns a string
|
||||||
|
* Each argument is a 8 Bit unsigned integer
|
||||||
|
* Returns the ColorString from rgb or rgba values
|
||||||
|
* Example: `minetest.rgba(10, 20, 30, 40)`, returns `"#0A141E28"`
|
||||||
* `minetest.encode_base64(string)`: returns string encoded in base64
|
* `minetest.encode_base64(string)`: returns string encoded in base64
|
||||||
* Encodes a string in base64.
|
* Encodes a string in base64.
|
||||||
* `minetest.decode_base64(string)`: returns string
|
* `minetest.decode_base64(string)`: returns string
|
||||||
|
Loading…
Reference in New Issue
Block a user