diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-16 15:50:12 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-06-16 15:50:12 -0300 |
| commit | 8cd7ae7da06f54b97f95d6994d6bf47086e4e7eb (patch) | |
| tree | cb274fe70f332e3151abea0c58fde17c9c127e57 /testes | |
| parent | 0cecf1ab6d76e6a7d200fb01bdd999b61835fe21 (diff) | |
| download | lua-8cd7ae7da06f54b97f95d6994d6bf47086e4e7eb.tar.gz lua-8cd7ae7da06f54b97f95d6994d6bf47086e4e7eb.tar.bz2 lua-8cd7ae7da06f54b97f95d6994d6bf47086e4e7eb.zip | |
Simpler code for 'traversetable'
Check the mode in a separate function (getmode), instead of using
comma expressions inside the 'if' condition.
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/gc.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index ca8aa1bc..5d2b3085 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
| @@ -288,6 +288,11 @@ x,y,z=nil | |||
| 288 | collectgarbage() | 288 | collectgarbage() |
| 289 | assert(next(a) == string.rep('$', 11)) | 289 | assert(next(a) == string.rep('$', 11)) |
| 290 | 290 | ||
| 291 | do -- invalid mode | ||
| 292 | local a = setmetatable({}, {__mode = 34}) | ||
| 293 | collectgarbage() | ||
| 294 | end | ||
| 295 | |||
| 291 | 296 | ||
| 292 | -- 'bug' in 5.1 | 297 | -- 'bug' in 5.1 |
| 293 | a = {} | 298 | a = {} |
