lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

	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?

    local menu = {}
    menu.size = 0
    return menu

function Menu:sub(name)
    local submenu =
    self:add(name, submenu)
    return submenu

function Menu:add(name, id)
    local item = {}
    item[name] = id
    self[self.size] = item
    self.size = self.size+1
    return self

mainMenu =
    :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.