MikaellaChry / luaforwindows

Automatically exported from code.google.com/p/luaforwindows
0 stars 0 forks source link

for loop bug? #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using for loop to iterate through table skips first item when using interactive 
lua. Example code:

>t = {}
>t["color"] = "red"
>t["age"] = "eight"
>t["address"] = "My Address"
>for i,v in pairs(t) do print(v) end

'eight'
'My Address'
true

Downloaded SciTE from http://code.google.com/p/luaforwindows/. Example above 
works fine using the Lua command prompt just not from inside SciTE.

Original issue reported on code.google.com by andy.me...@gmail.com on 13 Nov 2010 at 12:12

GoogleCodeExporter commented 8 years ago
I tried this one because of its peculiarity...
I got the expected behavior.
Steps:
1. Open SciTe
2. Paste the following:

t = {}
t["color"] = "red"
t["age"] = "eight"
t["address"] = "My Address"

for i,v in pairs(t) do
    print(v)
end
3. Save the file somewhere as a .lua file.
4. Click on the 'Run Program' tool on the toolbar (a little green "play" 
button).
5. Watch the result in the prompt inside SciTe appear as:

>lua -e "io.stdout:setvbuf 'no'" "test.lua" 
red
eight
My Address
>Exit code: 0

Original comment by petsagou...@gmail.com on 2 Jan 2011 at 5:13

GoogleCodeExporter commented 8 years ago
It works for me. Also it worked for the second commenter.

Original comment by rpusz...@gmail.com on 6 Jun 2011 at 1:49