lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Eva,

Thanks for the reply, unfortunately it's not the answer. The code works fine
in every other instance for parsing tables, the problem only occurs when
data is entered into the table without a key, and I'm assuming the default
keys 1,2,3,4... apply in this case.

They first default key, 1, is returned for line1, but on calling lua_next
for the next iteration, (key 1 being at the top level of the stack, and the
table being a level below, calling lua_next(l,-2) causes the application to
bomb out.

It would seem to me that this is a bug in lua_next, but I hope I proven
incorrect. It is a very simple problem to reproduce. I've even dumped the
stack after every lua call to see if there are any issues, and everything is
fine, until that 2nd request (line2).

Cheers

Glen.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Eva Schmidt
Sent: 25 September 2007 15:13
To: Lua list
Subject: Re: Lua_next probles

Hello,

I'm not sure if I understand your problem. But often Lua bombs out due to an

invalid stack position access.

Maybe you forgot to pop something from the stack or to push something on it?

Hope that helps ...
Eva

BetGear - Glen wrote:
> Hello,
> 
>  
> 
> I'm very new to lua , but I have ran into a problem and I'm not sure 
> whether it's a bug or I'm missing the point.
> 
>  
> 
> I've integrated lua (latest version) into one of our c++ projects. The 
> lua script is used to set up dialog boxes for our application. I'm 
> having issues with parsing the table when  using a mixture of key and 
> default keys, ie
> 
>  
> 
> Dropdown1={xpos = 10, ypos=10, width=20, drop=100, "line1", "line2", 
> "line3"}
> 
>  
> 
> I'm using the standard c table parsing code that is described in the lua 
> manual. The issue appear to be when lua_next comes to parse the "line2" 
> data, "line1" is parsed correctly, with the key set to 1 as is expected, 
> but the next iteration causes lua to bomb out. Tracing into lua reveal 
> an invalid key error. Surely the line1,line2 and line3 lines will be 
> issued with the standard 1,2,3 key references.
> 
>  
> 
> Is this a bug? Is there a known workaround, or am I overlooking 
> something silly?
> 
>  
> 
> Any help would be most appreciated.
> 
>  
> 
> Glen.
>