t = {2,4,6} for k,v in pairs(t) do print(k, ",", v) if v == 4 then t[k]=nil end end print "Concurrent table modification OK (in tiny test case)" 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: | 827 / 214 |
Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) |