Fixed a few inconsitancy

This commit is contained in:
Cooldude2606
2018-05-20 19:04:24 +01:00
parent 7ccf1083d2
commit 28c6610a20
4 changed files with 9 additions and 12 deletions

View File

@@ -214,9 +214,6 @@ setmetatable(defines.lightcolor, _mt.lightcolor)
-- @module Color
-- @usage local Color = require('stdlib/color/color')
--require 'stdlib/defines/color'
local fail_if_missing = require 'game'['fail_if_missing']
local Color = {} --luacheck: allow defined top
--- Set a value for the alpha channel in the given color table.
@@ -266,7 +263,8 @@ end
-- @tparam[opt=1] float alpha the alpha value to set; such that ***[ 0 ⋜ value ⋜ 1 ]***
-- @treturn Concepts.Color a color table with RGB converted from Hex and with alpha
function Color.from_hex(hex, alpha)
fail_if_missing(hex, "missing color hex value")
if not _G.Game then error('StdLib/Game not loaded') end
_G.Game.fail_if_missing(hex, "missing color hex value")
if hex:find("#") then hex = hex:sub(2) end
if not(#hex == 6) then error("invalid color hex value: "..hex) end
local number = tonumber(hex, 16)