Comparison

init.lua @ 239:65a0d3fcbbad

verse: Switch connection ids to be a simple incrementing integer
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Nov 2011 22:48:02 +0000
parent 238:9b6fca5d9a02
child 240:e27bf761bea6
comparison
equal deleted inserted replaced
238:9b6fca5d9a02 239:65a0d3fcbbad
17 stream.__index = stream; 17 stream.__index = stream;
18 stream_mt = stream; 18 stream_mt = stream;
19 19
20 verse.plugins = {}; 20 verse.plugins = {};
21 21
22 local max_id = 0;
23
22 function verse.new(logger, base) 24 function verse.new(logger, base)
23 local t = setmetatable(base or {}, stream); 25 local t = setmetatable(base or {}, stream);
24 t.id = tostring(t):match("%x*$"); 26 max_id = max_id + 1;
27 t.id = tostring(max_id);
25 t.logger = logger or verse.new_logger("stream"..t.id); 28 t.logger = logger or verse.new_logger("stream"..t.id);
26 t.events = events.new(); 29 t.events = events.new();
27 t.plugins = {}; 30 t.plugins = {};
28 return t; 31 return t;
29 end 32 end