[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Fields in userdata ?
- From: erik@... (Erik Hougaard)
- Date: Wed, 09 Dec 1998 09:43:29 +0100
This is what I would like: (Im just throwing this out for discussion!)
A userdata type with field addressing:
Example 1.
Customer.Name = "Erik Hougaard"
Customer is a userdata, Name is "just" a field in my userdata.
I will have defined a "write" function to my userdata like this:
void WriteFieldValue(lua_Object LO,char *FieldName)
{
// Do all the stuff needed... Value "Erik Hougaard" is on stack!
}
Example 2.
print(Customer.Name)
I will have defined a "read" function to my userdata like this:
void ReadFieldValue(lua_Object LO,char *FieldName)
{
// Push field value to stack!
}
What should be done:
1. To a tag there should be option to add a "read" and a "write"
function
2. Userdata should be allowed in expressions ??
3. Lua should keep the "fieldname" for passing.
4. Call the "read" and "write" functions
So what do you think... Is there a better / Easier / Slicker way to do
this ??
Erik