Changeset

2337:9eb20b3f3bbb

prosody: Clarify and add some comments to describe what we're doing when and why
author Matthew Wild <mwild1@gmail.com>
date Tue, 08 Dec 2009 00:55:17 +0000
parents 2336:fb1d9d2444df
children 2338:2a163f6a4bc2
files prosody
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Mon Dec 07 19:26:50 2009 +0000
+++ b/prosody	Tue Dec 08 00:55:17 2009 +0000
@@ -16,6 +16,7 @@
 
 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
+-- Tell Lua where to find our libraries
 if CFG_SOURCEDIR then
 	package.path = CFG_SOURCEDIR.."/?.lua;"..package.path;
 	package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
@@ -24,6 +25,7 @@
 package.path = package.path..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.lua";
 package.cpath = package.cpath..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.so";
 
+-- Substitute ~ with path to home directory in data path
 if CFG_DATADIR then
 	if os.getenv("HOME") then
 		CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME"));
@@ -31,9 +33,10 @@
 end
 
 -- Required to be able to find packages installed with luarocks
-pcall(require, "luarocks.require")
+pcall(require, "luarocks.require");
 
--- Replace require with one that doesn't pollute _G
+-- Replace require() with one that doesn't pollute _G, required
+-- for neat sandboxing of modules
 do
 	local _realG = _G;
 	local _real_require = require;
@@ -52,8 +55,13 @@
 	end
 end
 
+-- Load the config-parsing module
+config = require "core.configmanager"
 
-config = require "core.configmanager"
+-- -- -- --
+-- Define the functions we call during startup, the 
+-- actual startup happens right at the end, where these
+-- functions get called
 
 function read_config()
 	-- TODO: Check for other formats when we add support for them
@@ -363,6 +371,7 @@
 	server.setquitting(true);
 end
 
+-- Are you ready? :)
 read_config();
 load_libraries();
 init_global_state();