Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Properties in AngelScript


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 RCL   Members   -  Reputation: 122

Like
0Likes
Like

Posted 11 September 2004 - 02:07 AM

Hi, I think it would be great if AngelScript supported properties (a kind of variables, which are accessed via pair of Get/Set functions). The actual variable may not even exist at all. Consider the following example: Let's say we have an in-game console and player has a [limited] access to internal game variables. Wouldn't it be nicer to let him type like: [CONSOLE] game.maxPlayers 32 when he wants to set the max number of players instead of clumsy [CONSOLE] game.SetMaxPlayers( 32 ) ? Of course it is possible to export variable maxPlayers through RegisterObjectProperty(), but what if this variable is not allowed to be changed at any time (and/or some action is required to be taken upon its change)? Cheers, RCL

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3267

Like
0Likes
Like

Posted 11 September 2004 - 03:10 AM

I recognize the usefulness of properties that are accessed with hidden functions. Thanks, I'll add your suggestion to the to-do list.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Deyja   Members   -  Reputation: 920

Like
0Likes
Like

Posted 11 September 2004 - 10:57 AM

You could use a class type with an assignment operator to emulate the setting behavior. Catching gets is more difficult. I'd do it in C++ with a copy constructor. The copy is 'getting' the value of the source. Whenever you pass by value the copy constructor is called. SomeClass.Member won't call it, but as soon as you try and store it or use it in any way, it will be called.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS