Valkrionn
The Hamster King
What you found is still very useful, though, as far as UI files are concerned. It also cuts down on the number of load calls to SaveUtils (only necessary when initializing; I've only got it in the Get functions) which decreases overhead.
So still, very nice.
Quick rewrite of a get function to properly initialize the value:
Everywhere else you would have a load function, you just replace it with pPlayer:GetDarkAgeTurns().
So still, very nice.
Quick rewrite of a get function to properly initialize the value:
Code:
function getDarkAgeTurns(self)
if (self.DarkAgeTurns == nil) then
self.DarkAgeTurns = load( self, "DarkAgeTurns" ) or 0;
end
return self.DarkAgeTurns;
end
Player.GetDarkAgeTurns = getDarkAgeTurns;
Everywhere else you would have a load function, you just replace it with pPlayer:GetDarkAgeTurns().