From e5c9e7e29fd34271522a4ed7dfc6b8b8ee6670cd Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 23 Jan 2013 13:18:58 +0100 Subject: Allow setting custom widget ids --- core.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core.lua') diff --git a/core.lua b/core.lua index 67602ac..533ab96 100644 --- a/core.lua +++ b/core.lua @@ -65,10 +65,15 @@ end -- -- Widget ID -- -local maxid = 0 +local maxid, uids = 0, {} +setmetatable(uids, {__index = function(t, i) + t[i] = {} + return t[i] +end}) + local function generateID() maxid = maxid + 1 - return maxid + return uids[maxid] end -- -- cgit v1.2.3-54-g00ecf