1 | t = {2,4,6} |
2 | for k,v in pairs(t) do |
3 | print(k, ",", v) |
4 | if v == 4 then t[k]=nil end |
5 | end |
6 | |
7 | print "Concurrent table modification OK (in tiny test case)" |
8 | return true |
See http://www.computercraft.info/forums2/index.php?/topic/290-table-concurrent-iteration-and-mutation/
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 168 | [visualize] |
Snippet ID: | #143 |
Snippet name: | Concurrent table modification |
Eternal ID of this version: | #143/1 |
Text MD5: | 53c34c200ebf565db40e175a6907c13b |
Author: | stefan |
Category: | |
Type: | Lua code - System test |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-01-12 16:42:52 |
Source code size: | 168 bytes / 8 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 828 / 214 |
Referenced in: | [show references] |