Once the .mod file is initially created. we probably want to add some code of our own. This is done with .lua files located within the addon's folder. Whether you put the Lua files in the same directory as the .mod or in subdirectories is up to you - just remember that when specifying the paths of code files in the mod file's <Files> section, all paths are relative to the location of the .mod file.
The first thing most addons do is create a table named after their addon that will hold the majority of their public functions and data. The reason for doing this is to keep everything compact and separate from other addons - this table serves essentially the same purpose that namespacing would in other languages.
TimeToDie = {}
After that, one can define functions that are part of that table. For instance, we can define the function that the .mod file says should be called once the addon's files are loaded:
function TimeToDie.Initialize()
-- code goes here
end
We can also use members of our main table to provide data that other code besides our addon might want to see:
TimeToDie.lastDeathTime = 0