diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-25 12:48:52 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-25 12:48:52 +0200 |
| commit | 2c6898964400e6fa77b0e368f477b739fc155f90 (patch) | |
| tree | 2d2bb6a9fea08b2d5b7fc24033ea6763374c3a6b /src | |
| parent | 5e3f33bd66ef5b21568fde7866ca4ba9a7496180 (diff) | |
| download | lanes-2c6898964400e6fa77b0e368f477b739fc155f90.tar.gz lanes-2c6898964400e6fa77b0e368f477b739fc155f90.tar.bz2 lanes-2c6898964400e6fa77b0e368f477b739fc155f90.zip | |
Fix lanes.gen not correctly detecting '*' misuse
Diffstat (limited to 'src')
| -rw-r--r-- | src/lanes.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index 92a8703..90f9cd2 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
| @@ -53,6 +53,7 @@ local assert = assert(assert) | |||
| 53 | local error = assert(error) | 53 | local error = assert(error) |
| 54 | local pairs = assert(pairs) | 54 | local pairs = assert(pairs) |
| 55 | local string = assert(string, "'string' library not available") | 55 | local string = assert(string, "'string' library not available") |
| 56 | local string_find = assert(string.find) | ||
| 56 | local string_gmatch = assert(string.gmatch) | 57 | local string_gmatch = assert(string.gmatch) |
| 57 | local string_format = assert(string.format) | 58 | local string_format = assert(string.format) |
| 58 | local select = assert(select) | 59 | local select = assert(select) |
| @@ -370,6 +371,9 @@ local gen = function(...) | |||
| 370 | -- check that the caller only provides reserved library names, and those only once | 371 | -- check that the caller only provides reserved library names, and those only once |
| 371 | -- "*" is a special case that doesn't require individual checking | 372 | -- "*" is a special case that doesn't require individual checking |
| 372 | if libs and libs ~= "*" then | 373 | if libs and libs ~= "*" then |
| 374 | if string_find(libs, "*", 2, true) then | ||
| 375 | error "Libs specification '*' must be used alone" | ||
| 376 | end | ||
| 373 | local found = {} | 377 | local found = {} |
| 374 | for s in string_gmatch(libs, "[%a%d.]+") do | 378 | for s in string_gmatch(libs, "[%a%d.]+") do |
| 375 | if not valid_libs[s] then | 379 | if not valid_libs[s] then |
| @@ -377,7 +381,7 @@ local gen = function(...) | |||
| 377 | else | 381 | else |
| 378 | found[s] = (found[s] or 0) + 1 | 382 | found[s] = (found[s] or 0) + 1 |
| 379 | if found[s] > 1 then | 383 | if found[s] > 1 then |
| 380 | error("libs specification contains '" .. s .. "' more than once", 2) | 384 | error("Libs specification contains '" .. s .. "' more than once", 2) |
| 381 | end | 385 | end |
| 382 | end | 386 | end |
| 383 | end | 387 | end |
