diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2011-03-30 19:16:39 +0200 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2011-03-30 19:44:17 +0200 |
commit | 2d5d798c24286f10c1bffd5ea4ac466c2c3a12fa (patch) | |
tree | 17cdd59743fde2e33361509e5e5b847c0b816926 /src/keeper.lua | |
parent | 5499ec1a61be9797c57834618a49731952b1d212 (diff) | |
download | lanes-2d5d798c24286f10c1bffd5ea4ac466c2c3a12fa.tar.gz lanes-2d5d798c24286f10c1bffd5ea4ac466c2c3a12fa.tar.bz2 lanes-2d5d798c24286f10c1bffd5ea4ac466c2c3a12fa.zip |
New features
* linda honors __tostring and __concat
* new accessor linda:keys(), to retrieve the list of keys with pending data inside a linda
* new lanes options packagepath and packagecpath, in case one needs to set them differently than the default
Diffstat (limited to 'src/keeper.lua')
-rw-r--r-- | src/keeper.lua | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/keeper.lua b/src/keeper.lua index 2c38c0b..4bb181a 100644 --- a/src/keeper.lua +++ b/src/keeper.lua | |||
@@ -40,8 +40,9 @@ assert( nil_sentinel ) | |||
40 | 40 | ||
41 | -- We only need to have base and table libraries (and io for debugging) | 41 | -- We only need to have base and table libraries (and io for debugging) |
42 | -- | 42 | -- |
43 | local table_remove= assert( table.remove ) | 43 | local table_concat = assert( table.concat) |
44 | local table_concat= assert( table.concat ) | 44 | local table_insert = assert( table.insert) |
45 | local table_remove = assert( table.remove) | ||
45 | 46 | ||
46 | --[[ | 47 | --[[ |
47 | local function WR(...) | 48 | local function WR(...) |
@@ -230,6 +231,21 @@ end | |||
230 | 231 | ||
231 | 232 | ||
232 | ----- | 233 | ----- |
234 | -- [val]= keys( linda_deep_ud) | ||
235 | -- | ||
236 | function keys( ud) | ||
237 | |||
238 | local data,_,_= tables(ud) | ||
239 | |||
240 | local out = {} | ||
241 | for key, v in pairs( data) do | ||
242 | table_insert( out, key) | ||
243 | end | ||
244 | return (#out > 0) and out or nil | ||
245 | end | ||
246 | |||
247 | |||
248 | ----- | ||
233 | -- void= clear( linda_deep_ud ) | 249 | -- void= clear( linda_deep_ud ) |
234 | -- | 250 | -- |
235 | -- Clear the data structures used for a Linda (at its destructor) | 251 | -- Clear the data structures used for a Linda (at its destructor) |
@@ -240,5 +256,3 @@ function clear( ud ) | |||
240 | _incoming[ud]= nil | 256 | _incoming[ud]= nil |
241 | _limits[ud]= nil | 257 | _limits[ud]= nil |
242 | end | 258 | end |
243 | |||
244 | |||