rawget once

This commit is contained in:
Not 2022-08-31 04:44:43 +02:00
parent 7642dfaf98
commit 003dd98ce3
1 changed files with 15 additions and 7 deletions

View File

@ -397,17 +397,25 @@ local function exitlevel(player, ...)
end end
COM_AddCommand("exit", exitlevel) COM_AddCommand("exit", exitlevel)
local function browser(player) local DrawBrowser
local BrowserController
local function initBrowser(player)
if not doyoudare(player) then return end if not doyoudare(player) then return end
if not rawget(_G, "DrawBrowser") then if not DrawBrowser then
print("Browser is not loaded") DrawBrowser = rawget(_G, "DrawBrowser")
return if not DrawBrowser then
print("Browser is not loaded")
return
end
BrowserController = rawget(_G, "BrowserController")
end end
rawget(_G, "InitBrowser")(lb) rawget(_G, "InitBrowser")(lb)
drawState = DS_BROWSER drawState = DS_BROWSER
end end
COM_AddCommand("levelselect", browser) COM_AddCommand("levelselect", initBrowser)
local function zoneAct(map) local function zoneAct(map)
local z = "" local z = ""
@ -1131,7 +1139,7 @@ local function drawScrollTo(v, player, scoreTable, gui)
end end
local function drawBrowser(v, player) local function drawBrowser(v, player)
rawget(_G, "DrawBrowser")(v, lb) DrawBrowser(v, lb)
end end
local stateFunctions = { local stateFunctions = {
@ -1477,7 +1485,7 @@ local function think()
end end
end end
elseif drawState == DS_BROWSER then elseif drawState == DS_BROWSER then
if rawget(_G, "BrowserController")(p) then if BrowserController(p) then
drawState = DS_DEFAULT drawState = DS_DEFAULT
end end