BaseUI: Clearing the context is now an optional parameter & edit /list command. close #33
This commit is contained in:
@@ -2,9 +2,15 @@ local BaseUI, Formspec = Smc.requireBaseUI(), Smc.requireFormspec()
|
||||
|
||||
---@param self BaseUI
|
||||
---@param playerName string
|
||||
---@param isSelect boolean
|
||||
---@param isSelect boolean?
|
||||
---@return string
|
||||
local function getFormSpecString(self, playerName, isSelect)
|
||||
if isSelect == nil and self:getContex(playerName, 'select_item') ~= nil then
|
||||
isSelect = true
|
||||
else
|
||||
isSelect = false
|
||||
end
|
||||
|
||||
local items = {}
|
||||
|
||||
for name, def in pairs(core.registered_items) do
|
||||
@@ -58,9 +64,9 @@ local function getFormSpecString(self, playerName, isSelect)
|
||||
end
|
||||
|
||||
---@class AdminListUI : BaseUI
|
||||
---@field getFormSpecString fun(self:BaseUI,playerName:string,isSelect:boolean):string
|
||||
---@field showForm fun(self:BaseUI,playerName:string,isSelect:boolean):string
|
||||
local AdminListUI = BaseUI:new('admin_commands:list_form', getFormSpecString)
|
||||
---@field getFormSpecString fun(self:BaseUI,playerName:string,isSelect:boolean?):string
|
||||
---@field showForm fun(self:BaseUI,playerName:string,isSelect:boolean?):string
|
||||
local AdminListUI = BaseUI:new('admin_commands:list_form', getFormSpecString, false)
|
||||
|
||||
AdminListUI:registerOnFormFieldAction('admin_commands:list_items', function(player, fieldName, fieldValue)
|
||||
local scrollValue = string.match(fieldValue, 'CHG:(%S+)')
|
||||
|
||||
Reference in New Issue
Block a user