View Single Post
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 10-31-2017 , 10:48   Re: Dynamic Objects and Properties - v.0.0.30 - [2017.09.18]
Reply With Quote #248

Hello,

I love the idea of what you're trying to achieve here and I thought I'd give this a try today. I'm having some success but I'm a bit stuck on MethodMaps and Strings (sorry if you've answered this elsewhere). I've looked over the examples, grepped the inc files and see the type for string is boolean, other than char and trying to follow the prototypes, I'm just failing at this.

PHP Code:
char nameBuffer[64];

methodmap test Dynamic {
    
property char name {
        public 
get() {
            
this.GetString("name"nameBuffersizeof(nameBuffer));
        }

        public 
set(const char[] value) {
            
this.SetString("name"valuesizeof(value));
        }
    }
}

test();
x.name "Tom Foolhardy"
I've gone through a bunch of iterations of that code, with more and less arguments for the getter and setter and this is the closest I can get with the least amount of errors. How do you create a getter/setter for type string?

Thanks!
NgBUCKWANGS is offline