diff options
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 |