All your files are using quite some globals repeatedly. Upvalue those.
However, I was pretty shocked by your Board.lua file. You're leaking one-letter globals.
Code:
main <Board.lua:0,0> (18 instructions, 72 bytes at 005D1550)
[11] SETGLOBAL 3 -6 ; createBoard
function createBoard() <Board.lua:11,13> (6 instructions, 24 bytes at 0028EEF0)
function Board:generateBoard(width, maxWidth, height, maxHeight, numberOfMines) <Board.lua:16,35> (67 instructions, 268 bytes at 005D1760)
function Board:setBoard(width, height, numberOfMines, firstClickI, firstClickJ) <Board.lua:56,96> (217 instructions, 868 bytes at 0028EE40)
[71] SETGLOBAL 9 -5 ; ratioOfCurrentSquare
[86] SETGLOBAL 14 -11 ; j
[86] SETGLOBAL 13 -10 ; i
Make those either local, use the addon parent table (arg2 passed to your addon lua using ...), or make a global MineSweeper table and put them in there. But if any other addon uses a global called "j" or "i", you'll have your entire code crashing down on you.
Same for your Square.lua, though it's not quite as bad there.
Code:
main <Square.lua:0,0> (52 instructions, 208 bytes at 00571550)
[13] SETGLOBAL 4 -9 ; createSquare
[18] SETGLOBAL 3 -10 ; createDefaultSquare
[61] SETGLOBAL 3 -13 ; createEmptySquare
Those are far too generic names for global functions - especially since I don't see any reason to have them as globals.
---------- Post added 2011-04-04 at 04:36 PM ----------
Full global dumps:
Board.lua:
Code:
main <Board.lua:0,0> (18 instructions, 72 bytes at 001E1550)
[11] SETGLOBAL 3 -6 ; createBoard
function createBoard() <Board.lua:11,13> (6 instructions, 24 bytes at 004CEEF0)
[12] GETGLOBAL 0 -1 ; setmetatable
function Board:generateBoard(width, maxWidth, height, maxHeight, numberOfMines) <Board.lua:16,35> (67 instructions, 268 bytes at 001E1760)
[22] GETGLOBAL 11 -5 ; createEmptySquare
[23] GETGLOBAL 11 -5 ; createEmptySquare
[27] GETGLOBAL 11 -5 ; createEmptySquare
[28] GETGLOBAL 12 -5 ; createEmptySquare
[30] GETGLOBAL 15 -6 ; createDefaultSquare
function Board:setBoard(width, height, numberOfMines, firstClickI, firstClickJ) <Board.lua:56,96> (217 instructions, 868 bytes at 004CEE40)
[71] SETGLOBAL 9 -5 ; ratioOfCurrentSquare
[76] GETGLOBAL 17 -6 ; random
[86] SETGLOBAL 14 -11 ; j
[86] SETGLOBAL 13 -10 ; i
[87] GETGLOBAL 14 -10 ; i
[87] GETGLOBAL 14 -11 ; j
[87] GETGLOBAL 15 -10 ; i
[87] GETGLOBAL 15 -11 ; j
[88] GETGLOBAL 14 -10 ; i
[88] GETGLOBAL 14 -11 ; j
[88] GETGLOBAL 15 -10 ; i
[88] GETGLOBAL 15 -11 ; j
[89] GETGLOBAL 14 -10 ; i
[89] GETGLOBAL 14 -11 ; j
[89] GETGLOBAL 15 -10 ; i
[89] GETGLOBAL 15 -11 ; j
[90] GETGLOBAL 14 -10 ; i
[90] GETGLOBAL 14 -11 ; j
[90] GETGLOBAL 15 -10 ; i
[90] GETGLOBAL 15 -11 ; j
[91] GETGLOBAL 14 -10 ; i
[91] GETGLOBAL 14 -11 ; j
[91] GETGLOBAL 15 -10 ; i
[91] GETGLOBAL 15 -11 ; j
[92] GETGLOBAL 14 -10 ; i
[92] GETGLOBAL 14 -11 ; j
[92] GETGLOBAL 15 -10 ; i
[92] GETGLOBAL 15 -11 ; j
[93] GETGLOBAL 14 -10 ; i
[93] GETGLOBAL 14 -11 ; j
[93] GETGLOBAL 15 -10 ; i
[93] GETGLOBAL 15 -11 ; j
[94] GETGLOBAL 14 -10 ; i
[94] GETGLOBAL 14 -11 ; j
[94] GETGLOBAL 15 -10 ; i
[94] GETGLOBAL 15 -11 ; j
Core.lua:
Code:
main <Core.lua:0,0> (269 instructions, 1076 bytes at 00591550)
[144] SETGLOBAL 3 -83 ; getMineSweeper
function MineSweeper:resetBoard() <Core.lua:161,176> (59 instructions, 236 bytes at 0045ECF8)
[167] GETGLOBAL 3 -12 ; string
[168] GETGLOBAL 3 -12 ; string
function MineSweeper:handleNewHighScoreMessage(db, name, score, scoreDate) <Core.lua:178,191> (38 instructions, 152 bytes at 0059BFA8)
[179] GETGLOBAL 6 -1 ; tonumber
function MineSweeper:handleEvent(this, event, prefix, message, channel, sender) <Core.lua:208,258> (150 instructions, 600 bytes at 0059FE58)
[214] GETGLOBAL 10 -6 ; GetUnitName
[230] GETGLOBAL 7 -17 ; IsInInstance
[242] GETGLOBAL 9 -23 ; GetNumRaidMembers
[242] GETGLOBAL 9 -26 ; GetNumPartyMembers
function MineSweeper:showGameOnFlight() <Core.lua:272,276> (8 instructions, 32 bytes at 0046D470)
[273] GETGLOBAL 1 -1 ; UnitOnTaxi
function MineSweeper:OnInitialize() <Core.lua:490,543> (237 instructions, 948 bytes at 0046EC10)
[491] GETGLOBAL 1 -2 ; LibStub
[494] GETGLOBAL 1 -13 ; getMineSweeperFrame
[509] GETGLOBAL 1 -36 ; CreateFrame
[509] GETGLOBAL 4 -38 ; UIParent
[520] GETGLOBAL 6 -55 ; GetNumGuildMembers
[521] GETGLOBAL 6 -57 ; SendAddonMessage
[522] GETGLOBAL 6 -57 ; SendAddonMessage
[523] GETGLOBAL 6 -57 ; SendAddonMessage
[526] GETGLOBAL 6 -60 ; BNGetNumFriends
[528] GETGLOBAL 12 -61 ; BNGetFriendInfo
[530] GETGLOBAL 26 -63 ; BNSendWhisper
[531] GETGLOBAL 26 -63 ; BNSendWhisper
[532] GETGLOBAL 26 -63 ; BNSendWhisper
[536] GETGLOBAL 6 -68 ; GetNumFriends
[538] GETGLOBAL 12 -69 ; GetFriendInfo
[539] GETGLOBAL 13 -57 ; SendAddonMessage
[540] GETGLOBAL 13 -57 ; SendAddonMessage
[541] GETGLOBAL 13 -57 ; SendAddonMessage
function MineSweeper:createFrameAndBoard() <Core.lua:545,550> (31 instructions, 124 bytes at 0046ECC0)
[547] GETGLOBAL 3 -6 ; string
[548] GETGLOBAL 1 -11 ; createBoard
function MineSweeper:wonGame() <Core.lua:566,619> (296 instructions, 1184 bytes at 0046ED70)
[569] GETGLOBAL 1 -4 ; ipairs
[575] GETGLOBAL 2 -13 ; CalendarGetDate
[577] GETGLOBAL 6 -20 ; GetNumGuildMembers
[578] GETGLOBAL 6 -22 ; SendChatMessage
[578] GETGLOBAL 10 -27 ; GetChannelName
[580] GETGLOBAL 6 -30 ; GetNumRaidMembers
[581] GETGLOBAL 6 -22 ; SendChatMessage
[581] GETGLOBAL 10 -27 ; GetChannelName
[582] GETGLOBAL 6 -34 ; GetNumPartyMembers
[583] GETGLOBAL 6 -22 ; SendChatMessage
[583] GETGLOBAL 10 -27 ; GetChannelName
[586] GETGLOBAL 6 -22 ; SendChatMessage
[586] GETGLOBAL 10 -27 ; GetChannelName
[589] GETGLOBAL 7 -20 ; GetNumGuildMembers
[590] GETGLOBAL 7 -42 ; SendAddonMessage
[593] GETGLOBAL 7 -44 ; BNGetNumFriends
[595] GETGLOBAL 13 -45 ; BNGetFriendInfo
[597] GETGLOBAL 27 -47 ; BNSendWhisper
[601] GETGLOBAL 7 -50 ; GetNumFriends
[603] GETGLOBAL 13 -42 ; SendAddonMessage
[603] GETGLOBAL 17 -52 ; GetFriendInfo
[605] GETGLOBAL 13 -22 ; SendChatMessage
[605] GETGLOBAL 17 -52 ; GetFriendInfo
[610] GETGLOBAL 18 -64 ; string
[612] GETGLOBAL 15 -64 ; string
function MineSweeper:lostGame(mine) <Core.lua:621,639> (85 instructions, 340 bytes at 0046EDC8)
[630] GETGLOBAL 2 -12 ; ipairs
function MineSweeper:incrementTime() <Core.lua:649,656> (18 instructions, 72 bytes at 0046EED0)
[655] GETGLOBAL 3 -6 ; string
function MineSweeper:incrementNumberOfMinesLeft() <Core.lua:678,681> (12 instructions, 48 bytes at 0046F0E0)
[680] GETGLOBAL 3 -4 ; string
function MineSweeper:decrementNumberOfMinesLeft() <Core.lua:683,686> (12 instructions, 48 bytes at 0046F138)
[685] GETGLOBAL 3 -4 ; string
Frame.lua:
Code:
main <Frame.lua:0,0> (89 instructions, 356 bytes at 00821550)
[21] SETGLOBAL 2 -25 ; getMineSweeperFrame
function MineSweeperFrame:frameEndMove(move) <Frame.lua:29,32> (22 instructions, 88 bytes at 008286D0)
[31] SETGLOBAL 6 -3 ; _
[31] SETGLOBAL 5 -3 ; _
function MineSweeperFrame:dialogFrameEndMove(move) <Frame.lua:38,41> (22 instructions, 88 bytes at 00827FF0)
[40] SETGLOBAL 6 -3 ; _
[40] SETGLOBAL 5 -3 ; _
function MineSweeperFrame:createDialogFrame() <Frame.lua:43,452> (1578 instructions, 6312 bytes at 008280F0)
[44] GETGLOBAL 1 -2 ; CreateFrame
[44] GETGLOBAL 4 -4 ; UIParent
[54] GETGLOBAL 1 -2 ; CreateFrame
[70] GETGLOBAL 3 -2 ; CreateFrame
[94] GETGLOBAL 7 -2 ; CreateFrame
[103] GETGLOBAL 9 -2 ; CreateFrame
[114] GETGLOBAL 11 -2 ; CreateFrame
[125] GETGLOBAL 13 -2 ; CreateFrame
[136] GETGLOBAL 15 -2 ; CreateFrame
[147] GETGLOBAL 17 -2 ; CreateFrame
[158] GETGLOBAL 19 -2 ; CreateFrame
[169] GETGLOBAL 21 -2 ; CreateFrame
[180] GETGLOBAL 23 -2 ; CreateFrame
[195] GETGLOBAL 26 -2 ; CreateFrame
[206] GETGLOBAL 28 -2 ; CreateFrame
[217] GETGLOBAL 30 -2 ; CreateFrame
[228] GETGLOBAL 32 -2 ; CreateFrame
[239] GETGLOBAL 34 -2 ; CreateFrame
[250] GETGLOBAL 36 -2 ; CreateFrame
[265] GETGLOBAL 39 -2 ; CreateFrame
[269] GETGLOBAL 40 -2 ; CreateFrame
[282] GETGLOBAL 41 -2 ; CreateFrame
[294] GETGLOBAL 42 -2 ; CreateFrame
[305] GETGLOBAL 43 -2 ; CreateFrame
[310] GETGLOBAL 44 -2 ; CreateFrame
[315] GETGLOBAL 45 -2 ; CreateFrame
[323] GETGLOBAL 45 -2 ; CreateFrame
[328] GETGLOBAL 46 -2 ; CreateFrame
[341] GETGLOBAL 47 -2 ; CreateFrame
[347] GETGLOBAL 47 -2 ; CreateFrame
[367] GETGLOBAL 52 -182 ; string
[394] GETGLOBAL 60 -182 ; string
[395] GETGLOBAL 60 -182 ; string
[396] GETGLOBAL 60 -182 ; string
[397] GETGLOBAL 60 -182 ; string
[398] GETGLOBAL 60 -182 ; string
[400] GETGLOBAL 60 -182 ; string
[403] GETGLOBAL 60 -182 ; string
[404] GETGLOBAL 60 -182 ; string
[413] GETGLOBAL 49 -2 ; CreateFrame
[419] GETGLOBAL 50 -2 ; CreateFrame
[425] GETGLOBAL 51 -2 ; CreateFrame
[431] GETGLOBAL 52 -2 ; CreateFrame
[437] GETGLOBAL 53 -218 ; PanelTemplates_SetNumTabs
[439] GETGLOBAL 53 -219 ; PanelTemplates_SetTab
[440] GETGLOBAL 53 -220 ; FauxScrollFrame_Update
[442] GETGLOBAL 53 -219 ; PanelTemplates_SetTab
[443] GETGLOBAL 53 -220 ; FauxScrollFrame_Update
[445] GETGLOBAL 53 -219 ; PanelTemplates_SetTab
[446] GETGLOBAL 53 -220 ; FauxScrollFrame_Update
[448] GETGLOBAL 53 -219 ; PanelTemplates_SetTab
function(self, offset) <Frame.lua:350,350> (8 instructions, 32 bytes at 00461C80)
[350] GETGLOBAL 2 -1 ; FauxScrollFrame_OnVerticalScroll
function MineSweeperFrame:reloadLeaderboard() <Frame.lua:481,527> (274 instructions, 1096 bytes at 00461F40)
[496] GETGLOBAL 6 -21 ; string
[503] GETGLOBAL 3 -27 ; FauxScrollFrame_Update
[514] GETGLOBAL 9 -21 ; string
[515] GETGLOBAL 9 -21 ; string
[516] GETGLOBAL 9 -21 ; string
[517] GETGLOBAL 9 -21 ; string
[518] GETGLOBAL 9 -21 ; string
[520] GETGLOBAL 9 -21 ; string
[523] GETGLOBAL 9 -21 ; string
[524] GETGLOBAL 9 -21 ; string
function MineSweeperFrame:setTab(id, associatedFrame, hideFrame) <Frame.lua:555,580> (74 instructions, 296 bytes at 00462048)
[556] GETGLOBAL 4 -1 ; PanelTemplates_SetTab
function MineSweeperFrame:createFrame(width, height) <Frame.lua:582,695> (430 instructions, 1720 bytes at 004620A0)
[583] GETGLOBAL 3 -2 ; CreateFrame
[583] GETGLOBAL 6 -4 ; UIParent
[595] GETGLOBAL 3 -2 ; CreateFrame
[604] GETGLOBAL 4 -2 ; CreateFrame
[613] GETGLOBAL 5 -2 ; CreateFrame
[615] GETGLOBAL 6 -47 ; UIDropDownMenu_Initialize
[616] GETGLOBAL 6 -48 ; UIDropDownMenu_SetWidth
[618] GETGLOBAL 6 -2 ; CreateFrame
[628] GETGLOBAL 8 -2 ; CreateFrame
[652] GETGLOBAL 12 -2 ; CreateFrame
[662] GETGLOBAL 13 -2 ; CreateFrame
[672] GETGLOBAL 14 -2 ; CreateFrame
[678] GETGLOBAL 15 -2 ; CreateFrame
[687] GETGLOBAL 15 -2 ; CreateFrame
function() <Frame.lua:619,619> (9 instructions, 36 bytes at 00462258)
[619] GETGLOBAL 0 -1 ; ToggleDropDownMenu
function MineSweeperFrame:dropDownMenuOnLoad(self, level) <Frame.lua:697,717> (33 instructions, 132 bytes at 00462410)
[703] GETGLOBAL 4 -6 ; UIDropDownMenu_AddButton
[709] GETGLOBAL 5 -6 ; UIDropDownMenu_AddButton
[715] GETGLOBAL 6 -6 ; UIDropDownMenu_AddButton
Square.lua:
Code:
main <Square.lua:0,0> (52 instructions, 208 bytes at 008A1550)
[13] SETGLOBAL 4 -9 ; createSquare
[18] SETGLOBAL 3 -10 ; createDefaultSquare
[61] SETGLOBAL 3 -13 ; createEmptySquare
function createSquare() <Square.lua:13,15> (6 instructions, 24 bytes at 008A16B0)
[14] GETGLOBAL 0 -1 ; setmetatable
function createDefaultSquare(i, j) <Square.lua:18,28> (37 instructions, 148 bytes at 0025EE10)
[19] GETGLOBAL 2 -1 ; createSquare
[20] GETGLOBAL 3 -3 ; CreateFrame
function createEmptySquare() <Square.lua:61,65> (5 instructions, 20 bytes at 008ABED0)
[62] GETGLOBAL 0 -1 ; createSquare