how to create object with given names
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: how to create object with given names
 
- From: "Jiangwei Li" <jli@...>
 
- Date: Tue, 4 May 2004 17:26:13 -0700
 
hi, 
i am new to lua, and want to use it in my project.
however, i got a question as following:
i would like to create objects in C 
based on names specified in the script table. 
for example:
I have a c data structure 
typedef Point_s {
 int x, y
} Point_t;
In script, I have a table:
PointsToBeCreated = {
 east="1,0",
 north="0, 1",
}
In c, I want to create two objects
of type Point_t, one called
"east" and one called "north", based
on what is given in the 
table "PointsToBeCreated".
So, later, in the script, i can say:
setPosition = function ()
 local a = east -- note: east is auto created
 ...
 ...
end
can anyone please tell me 
how to do the this using lua c api?
thanks and best regards,
jiangwei li