Warning: file_get_contents(http://localhost:8000/calc?cmd=143&userid=0&debug=1): failed to open stream: Cannot assign requested address in /var/www/tb/show-snippet.php on line 158
Concurrent table modification [143]

Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #143 // Concurrent table modification

Lua code - System test

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

Author comment

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   

Relations

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Image recognition results

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: 826 / 214
Referenced in: [show references]