diff options
Diffstat (limited to 'src/lanes.lua')
-rw-r--r-- | src/lanes.lua | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index affbd7d..35071ae 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -40,9 +40,8 @@ local core = require "lanes.core" | |||
40 | -- Lua 5.2: module() is gone | 40 | -- Lua 5.2: module() is gone |
41 | -- almost everything module() does is done by require() anyway | 41 | -- almost everything module() does is done by require() anyway |
42 | -- -> simply create a table, populate it, return it, and be done | 42 | -- -> simply create a table, populate it, return it, and be done |
43 | local lanes = {} | ||
44 | local lanesMeta = {} | 43 | local lanesMeta = {} |
45 | setmetatable(lanes,lanesMeta) | 44 | local lanes = setmetatable( {}, lanesMeta) |
46 | 45 | ||
47 | -- this function is available in the public interface until it is called, after which it disappears | 46 | -- this function is available in the public interface until it is called, after which it disappears |
48 | lanes.configure = function( settings_) | 47 | lanes.configure = function( settings_) |
@@ -55,7 +54,7 @@ lanes.configure = function( settings_) | |||
55 | error( "To use 'lanes', you will also need to have 'string' available.", 2) | 54 | error( "To use 'lanes', you will also need to have 'string' available.", 2) |
56 | end | 55 | end |
57 | -- Configure called so remove metatable from lanes | 56 | -- Configure called so remove metatable from lanes |
58 | setmetatable(lanes,nil) | 57 | setmetatable( lanes, nil) |
59 | -- | 58 | -- |
60 | -- Cache globals for code that might run under sandboxing | 59 | -- Cache globals for code that might run under sandboxing |
61 | -- | 60 | -- |
@@ -139,7 +138,7 @@ lanes.configure = function( settings_) | |||
139 | author= "Asko Kauppi <akauppi@gmail.com>, Benoit Germain <bnt.germain@gmail.com>", | 138 | author= "Asko Kauppi <akauppi@gmail.com>, Benoit Germain <bnt.germain@gmail.com>", |
140 | description= "Running multiple Lua states in parallel", | 139 | description= "Running multiple Lua states in parallel", |
141 | license= "MIT/X11", | 140 | license= "MIT/X11", |
142 | copyright= "Copyright (c) 2007-10, Asko Kauppi; (c) 2011-13, Benoit Germain", | 141 | copyright= "Copyright (c) 2007-10, Asko Kauppi; (c) 2011-17, Benoit Germain", |
143 | version = assert( core.version) | 142 | version = assert( core.version) |
144 | } | 143 | } |
145 | 144 | ||
@@ -716,6 +715,7 @@ lanes.configure = function( settings_) | |||
716 | 715 | ||
717 | -- activate full interface | 716 | -- activate full interface |
718 | lanes.require = core.require | 717 | lanes.require = core.require |
718 | lanes.register = core.register | ||
719 | lanes.gen = gen | 719 | lanes.gen = gen |
720 | lanes.linda = core.linda | 720 | lanes.linda = core.linda |
721 | lanes.cancel_error = core.cancel_error | 721 | lanes.cancel_error = core.cancel_error |
@@ -734,20 +734,18 @@ lanes.configure = function( settings_) | |||
734 | return lanes | 734 | return lanes |
735 | end -- lanes.configure | 735 | end -- lanes.configure |
736 | 736 | ||
737 | lanesMeta.__index = function(t,k) | 737 | lanesMeta.__index = function( t, k) |
738 | -- This is called when some functionality is accessed without calling configure() | 738 | -- This is called when some functionality is accessed without calling configure() |
739 | lanes.configure() -- Initialize with default settings | 739 | lanes.configure() -- initialize with default settings |
740 | -- Access the required key | 740 | -- Access the required key |
741 | return lanes[k] | 741 | return lanes[k] |
742 | end | 742 | end |
743 | 743 | ||
744 | -- no need to force calling configure() excepted the first time | 744 | -- no need to force calling configure() manually excepted the first time (other times will reuse the internally stored settings of the first call) |
745 | if core.settings then | 745 | if core.settings then |
746 | return lanes.configure() | 746 | return lanes.configure() |
747 | else | 747 | else |
748 | return lanes | 748 | return lanes |
749 | end | 749 | end |
750 | 750 | ||
751 | 751 | --the end | |
752 | --the end (Unreachable Code) | ||
753 | --return lanes | ||