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
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 rawget(_G, "DrawBrowser") then
print("Browser is not loaded")
return
if not DrawBrowser then
DrawBrowser = rawget(_G, "DrawBrowser")
if not DrawBrowser then
print("Browser is not loaded")
return
end
BrowserController = rawget(_G, "BrowserController")
end
rawget(_G, "InitBrowser")(lb)
drawState = DS_BROWSER
end
COM_AddCommand("levelselect", browser)
COM_AddCommand("levelselect", initBrowser)
local function zoneAct(map)
local z = ""
@ -1131,7 +1139,7 @@ local function drawScrollTo(v, player, scoreTable, gui)
end
local function drawBrowser(v, player)
rawget(_G, "DrawBrowser")(v, lb)
DrawBrowser(v, lb)
end
local stateFunctions = {
@ -1477,7 +1485,7 @@ local function think()
end
end
elseif drawState == DS_BROWSER then
if rawget(_G, "BrowserController")(p) then
if BrowserController(p) then
drawState = DS_DEFAULT
end