Closed matsn0w closed 11 months ago
Hi!
What's the exact problem you have?
As it's mostly the question of defining a proper menu config structure. Send configs to a client, create all menus once and then use these configs to draw anything you need.
Abstract example below:
function displayMenuFromConfig(menuConfig)
WarMenu.Begin(menuConfig.id)
for _, control in ipairs(menuConfig.controls) do
if control.button then
if WarMenu.Button(control.button.text, control.button.subText) then
if control.button.spawn then
-- Spawn something
end
end
end
end
WarMenu.End()
end
Hey there,
I am creating a menu with your framework - it's working great so far!
One thing I am struggling with is the following: I want my menu resource to be 'dynamic'. This means that the server owner can define a menu structure using a config file. Each menu item is created through a function which defines the title, action and optionally a submenu it belongs to.
The menu structure is defined as follows:
Menu entries ('commands') are created using this function:
I want to loop over all submenus and dynamically create
MenuButtons
for them. In your example, you are using anif-elseif
statement with theBegin()
method. That asumes that you already now the menu structure beforehand, which is not the case for me.Do you have an idea how my goal can be achieved? Maybe some change is needed? Am I missing something?
Thank you in advance, matsn0w