[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Menus and submenus (WAS: Forward Declaration)
- From: "Speight.Marcus" <marcus.speight@...>
- Date: Wed, 15 Oct 2003 07:28:52 -0700
Hi,
I tried to implement the following but came up with a runtime error.
I can't seem to be able to locate it can anyone help please?
function Menu.new()
local menu = {}
menu.size = 0
return menu
end
function Menu:sub(name)
local submenu = Menu.new
self:add(name, submenu)
return submenu
end
function Menu:add(name, id)
local item = {}
item[name] = id
self[self.size] = item
self.size = self.size+1
return self
end
mainMenu = Menu.new
:sub "New"
:add("New Campaign", ID_CAMPAIGN)
:add("New Random Map", ID_RANDOMMAP)
:add("Back", ID_BACK)
:add("Load Game", ID_LOADGAME)
:add("Exit", ID_EXIT)
Marcus Speight
Software Engineer
Vivid Gaming
The views expressed in this message are those of the sender and not
necessarily those of IGT - UK Limited and its associated companies.