setProperty
API - this is just a helper function to set a default value, but if a value already exists it will do nothing.
return function()
setProperty(data, 'test', 20);
log(data.test); --prints 20
data.test = 30;
log(data.test); --prints 30
setProperty(data, 'test', 20); --this will not set the property, since it already exists!
log(data.test); --prints 30
end
Last updated