Comparison

net/server.lua @ 2136:23c687039652

net.server: Add some comments to explain to waqas how it all works :)
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 14:42:56 +0000
parent 2105:fecf33cb2913
child 2162:22b6b1899a55
comparison
equal deleted inserted replaced
2135:2119a5d603d8 2136:23c687039652
3 3
4 local server; 4 local server;
5 5
6 if have_luaevent and use_luaevent == true then 6 if have_luaevent and use_luaevent == true then
7 server = require "net.server_event"; 7 server = require "net.server_event";
8 -- util.timer requires "net.server", so instead of having
9 -- Lua look for, and load us again (causing a loop) - set this here
10 -- (usually it isn't set until we return, look down there...)
8 package.loaded["net.server"] = server; 11 package.loaded["net.server"] = server;
9 12
10 -- Backwards compatibility for timers, addtimer 13 -- Backwards compatibility for timers, addtimer
11 -- called a function roughly every second 14 -- called a function roughly every second
12 local add_task = require "util.timer".add_task; 15 local add_task = require "util.timer".add_task;
16 else 19 else
17 server = require "net.server_select"; 20 server = require "net.server_select";
18 package.loaded["net.server"] = server; 21 package.loaded["net.server"] = server;
19 end 22 end
20 23
21 return server; 24 -- require "net.server" shall now forever return this,
25 -- ie. server_select or server_event as chosen above.
26 return server;