[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: LuaPas and array of record
- From: jdarling@...
- Date: Fri, 30 Jun 2006 05:55:45 -0700
Yep, fat finger mistake on my part :). Unfortunately my dev box is
hardly ever on the web, so I end up having to re-type most code for
review/suggest.
- Jeremy
"Help I suffer from the oxymoron Corporate Security."
> -------- Original Message --------
> Subject: Re: LuaPas and array of record
> From: Jilani Khaldi <jilani.khaldi1@virgilio.it>
> Date: Thu, June 29, 2006 4:09 pm
> To: Lua list <lua@bazar2.conectiva.com.br>
>
> jdarling@eonclash.com wrote:
>
> >Here we go, hopefully I don't fat finger anything in here :)
> >
> >procedure LoadToArray(L : PLua_State; TableName : String; var LoadInto :
> >array of RecType);
> >var
> > idxTable, idxTemp,
> > idxSubTable : Integer;
> > Key, SubKey : String;
> > SubVal : Double;
> >begin
> > SetLength(LoadInto, 0);
> > lua_pushstring(L, PChar(TableName));
> > lua_gettable(L, LUA_GLOBALSINDEX);
> > if lua_type(L, -1) <> LUA_TTABLE then
> > raise exception.Create('Table expected for identifier
> >"'+TableName+'"');
> > idxTable := lua_gettop(L);
> > lua_pushnil(L);
> > while (lua_next(L, idxTable)<>0) do
> > begin
> > SetLength(LoadInto, Length(LoadInto)+1);
> >
> >
> I changed this line:
>
> > Key := lua_tostring(L, -2);
> >
> >
> in :
>
> Key := lua_tostring(L, -2);
> and it works now. Is it correct now?
> Thanks!
>
> jk