diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-01-24 22:46:21 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-01-24 22:46:21 +0100 |
commit | 68d8db431ec2b739dc53233d6b4d8aeee9324e48 (patch) | |
tree | d8f0fbe0f8c4e1a07ac4248fd1b7673f49beb4d3 /src/lanes.lua | |
parent | 623fb3c0cae9beb3d5e7d3f7424b47d80041c1ac (diff) | |
download | lanes-3.4.3.tar.gz lanes-3.4.3.tar.bz2 lanes-3.4.3.zip |
version 3.4.3v3.4.3
* raise an error if lane generator libs specification contains a lib more than once
* bit32 is a valid lib name in the libs specification (silently ignored by the Lua 5.1 build)
* improved lanes.nameof to search inside table- and userdata- metatables for an object's name
* fixed an unwarranted error when trying to discover a function name upon a failed transfer
* contents of package.[path,cpath,preload,loaders|searchers] are pulled *only once* inside keeper states at initialisation
* Lua function upvalues equal to the global environment aren't copied by value, but bound to the destination's global environment
especially useful for Lua 5.2 _ENV
* fixed loading of base libraries that didn't create the global tables when built for Lua 5.2
Diffstat (limited to 'src/lanes.lua')
-rw-r--r-- | src/lanes.lua | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index 8c135c2..6bd9e44 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -210,10 +210,10 @@ local valid_libs= { | |||
210 | ["string"]= true, | 210 | ["string"]= true, |
211 | ["math"]= true, | 211 | ["math"]= true, |
212 | ["debug"]= true, | 212 | ["debug"]= true, |
213 | ["bit32"]= true, -- Lua 5.2 only, ignored silently under 5.1 | ||
213 | -- | 214 | -- |
214 | ["base"]= true, | 215 | ["base"]= true, |
215 | ["coroutine"]= true, | 216 | ["coroutine"]= true |
216 | ["*"]= true | ||
217 | } | 217 | } |
218 | 218 | ||
219 | -- PUBLIC LANES API | 219 | -- PUBLIC LANES API |
@@ -251,11 +251,19 @@ local function gen( ... ) | |||
251 | 251 | ||
252 | -- Check 'libs' already here, so the error goes in the right place | 252 | -- Check 'libs' already here, so the error goes in the right place |
253 | -- (otherwise will be noticed only once the generator is called) | 253 | -- (otherwise will be noticed only once the generator is called) |
254 | -- "*" is a special case that doesn't require individual checking | ||
254 | -- | 255 | -- |
255 | if libs then | 256 | if libs and libs ~= "*" then |
256 | for s in string_gmatch(libs, "[%a*]+") do | 257 | local found = {} |
258 | -- check that the caller only provides reserved library names | ||
259 | for s in string_gmatch(libs, "[%a%d]+") do | ||
257 | if not valid_libs[s] then | 260 | if not valid_libs[s] then |
258 | error( "Bad library name: "..s ) | 261 | error( "Bad library name: " .. s) |
262 | else | ||
263 | found[s] = (found[s] or 0) + 1 | ||
264 | if found[s] > 1 then | ||
265 | error( "libs specification contains '" .. s .. "' more than once") | ||
266 | end | ||
259 | end | 267 | end |
260 | end | 268 | end |
261 | end | 269 | end |