Files
BusyRabbit/Content/Lua/Utils/UI/WidgetUtils.lua

23 lines
537 B
Lua

local GameplayStatics = import("GameplayStatics")
local WidgetUtils = {}
local function GetHud(wco)
local pc = GameplayStatics.GetPlayerController(wco, 0)
if pc == nil then return end
return pc:GetHud()
end
function WidgetUtils.Show(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:BP_PushWidget(widget_name)
end
function WidgetUtils.Close(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:PopWidget(widget_name)
end
return WidgetUtils