--[[nef_20221122 SUPPORT_basic All support functions are contained in the table game.SP. This module contains the following functions: user - returns the human player as userdata Player colored_link - can be used instead of the featured text link but will add a suitable background color. background - the table (function) used for colored_link allowing for more complex message strings. Requires the FEATURED_TEXT module. ]] do -- SUPPORT_basic local _G = _G local _ENV = _ENV _ENV = _G.log --[[ disable this if you want featured (etc.) to be global, or change it to any other global table.]] local featured = _G.setmetatable({},{ -- FEATURED_TEXT __index = function(t,k) local ft = featured return _G.assert(ft and ft[k], 'Featured text not loaded.' ) end;}) local function link (...) link = featured.link; return link (...) end local function color(...) color = featured.color; return color(...) end -- SUPPORT_basic local function DUP(t) return t,t end local _ENV = _ENV _ENV = _G.game --[[ disable this if you want SP to be global, or change it to any other global table.]] _ENV, SP = DUP( SP or _G.setmetatable({},{ __index = function(t,k) if k == 'user' then for player in _G.players_iterate() do if player.ai_controlled then else t[k] = function () return player end return t[k] end end end end; })) background = _G.setmetatable({Tile = "#ffffff";City = "#400040";Unit = '#404000';}, {__index = function(t,k) return "#ffffff" end; __call = function(t,v) return t[_G.tolua.type(v)] end;}) colored_link = function (object, text) return color (link(object, text),nil,background(object)) end; end -- end SUPPORT_basic