lua-users home
lua-l archive

LuaPas and array of record

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


Hi All,
now the big next step. I have this table of tables in Lua:
tab={
{f="a", v=1},
{f="b", v=-3},
{f="c", v=2}
}
and
the array of record in Delphi:
type
 RecType = record
 name: string[24];
 value: double;
 end;
 ArrType = array of RecType;
var
 a: ArrType;
...
begin
 SetLength(a,3);
How to do get this:
 a[0].name := tab[1].f;
 a[0].value := tab[1].v;
 a[1].name := tab[2].f;
 a[1].value := tab[2].v;
 a[2].name := tab[3].f;
 a[2].value := tab[3].v;
end;
It was so easy to access to lua single table values from Pascal (translating the C code from the manual), but I couldn't find the right way to solve this one. Seen I am using only LuaPas, I prefer to stay close to the C way to access Lua code without using any OO wrappers...
Thank you!
jk

AltStyle によって変換されたページ (->オリジナル) /