Not that easy :) # correctly returns length-1 element in my case. 2014-03-27 9:22 GMT+02:00 Maik Nijhuis <manyac@xxxxxxxxx>: > 2014-03-26 22:14 GMT+01:00 Denis Golovan <denis.golovan@xxxxxxxxx>: > >> >> for i=0,#arr do >> if arr[i] then -- native boolean array access >> ... >> end >> end >> >> It looks like "arr" (which is just a wrapper for a pointer to a native >> array first element) points nowhere or "i" index goes into a large >> negative value. >> > When accessing native arrays, #arr - 1 is the latest valid index, so your > for loop should look like > > for i=0,#arr-1 do ... end > > Maik