lua-users home
lua-l archive

How to access array inside a table from C code ?

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


I have a table, actually a class, like
T =
{
Ptr = nil, -- pointer to a C++ class
Array = nil, -- an array of numbers
}
function T:SetArray( a )
self.Array = a
end
I want to set items in Array like
a = {}
a[1] = 15
a[2] = 12
a[3] = 500
(etc.)
T:SetArray( a )
I want to be able to access all the array entries, Array[1], ... from a C function. But I cannot seem to figure out how to do this. Help would be appreicated.
Michael

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