[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: possible bug *with versions*
- From: Mason Mackaman <masondeanm@...>
- Date: Sat, 30 Mar 2013 12:27:34 -0400 (EDT)
sorry, I realized right after I sent the message I forgot to include
what version I was working with. I've confirmed this happening with
5.1.4 and 5.2.0.
Hello everyone, I'm pretty new to programming and even newer to Lua, so
please humor me. I feel I've found a bug but it's most likely just me
being a noob.
function f(set)
local newset,cloneset={},set
for x=1,#cloneset do
newset[x]=cloneset[#cloneset]
table.remove(cloneset)
end
return newset
end
function
g(set)
set=f(set)
end
a={1,2,3,4,5,6,7,8,9}
g(a)
print(#a)
This is the simplest form I can put the bug in. I feel like it should
output 9 but instead it outputs 0. If someone could tell my why this is
happening I would be much obliged.
info:
- #f(a)=9
- every time table.remove(cloneset) is executed it also executes the
equivalent of table.remove(a)