Fixed player_return colour error

This commit is contained in:
Cooldude2606
2019-02-15 18:33:32 +00:00
parent 10cc18aeb2
commit f99c17ef77

View File

@@ -115,7 +115,7 @@ end
function ExpLib.player_return(rtn,colour,player) function ExpLib.player_return(rtn,colour,player)
colour = ExpLib.is_type(colour,'table') and colour or defines.textcolor[colour] ~= defines.color.white and defines.textcolor[colour] or defines.color[colour] colour = ExpLib.is_type(colour,'table') and colour or defines.textcolor[colour] ~= defines.color.white and defines.textcolor[colour] or defines.color[colour]
player = player or game.player player = player or game.player
local function _return(callback,rtn) local function returnWith(callback,use_colour)
if ExpLib.is_type(rtn,'table',use_colour) then if ExpLib.is_type(rtn,'table',use_colour) then
-- test for: userdata, locale string, table with __tostring meta method, any other table -- test for: userdata, locale string, table with __tostring meta method, any other table
if ExpLib.is_type(rtn.__self,'userdata') then callback('Cant Display Userdata',use_colour) if ExpLib.is_type(rtn.__self,'userdata') then callback('Cant Display Userdata',use_colour)
@@ -133,8 +133,8 @@ function ExpLib.player_return(rtn,colour,player)
if not player then error('Invalid Player given to player_return',2) end if not player then error('Invalid Player given to player_return',2) end
-- plays a nice sound that is different to normal message sound -- plays a nice sound that is different to normal message sound
player.play_sound{path='utility/scenario_message'} player.play_sound{path='utility/scenario_message'}
_return(player.print,rtn,colour) returnWith(player.print,colour)
else _return(rcon.print,rtn) end else returnWith(rcon.print) end
end end
--- Convert ticks to hours --- Convert ticks to hours