Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


- - - - -

The dictionary class


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 pbody2012   Members   -  Reputation: 115

Like
0Likes
Like

Posted 16 February 2013 - 08:42 PM

Is it possible to have the dictionary in angelscript with a different syntax?  The reason for this question is because I was originally going to use Lua in a project that I am working on, because I love its design in regards to its tables.  They can be used as a means of doing configurations, but binding to a lua vm and then performing operations are mind boggling.  Binding c++ to angelscript is what really won me over because it is pretty straightforward.  Also because there is no vm to worry about because it just makes native calls.

 

However, I would like to also use angelscript as a configuration language if possible.  Can there be lua like tables or something close to it ( the dictionary with some syntax sugar ).

 

dict = { ("one",1), ("object",object), ("handle",@handle) };

 

or

 

dict.set( ("one",1), ("object",object), ("handle",@handle) );

 

or

 

something



Sponsor:

#2 saejox   Members   -  Reputation: 714

Like
0Likes
Like

Posted 17 February 2013 - 04:39 AM

No.

Lua tables are the result of Lua being a prototypical language.

It's not possible to have dictionaries that hold varying types.

 

You can sort of emulate it with dictionary addon and any addon. Not pretty tho.



#3 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 17 February 2013 - 08:26 AM

I also like the versatility of Lua's tables (though I've never used Lua myself). Unfortunately implementing something Lua's tables within AngelScript is not an easy task as they rely heavily on dynamic types, where-as AngelScript is statically typed. It can be done, but would require quite a few changes to the library.

 

Instead, may I suggest you take a look at XML for the data configuration, and then create and register an object for reading/interacting with the XML from the script?

 

The scripts can be placed as content of the XML (similarly to how javascript is often used embedded in HTML files). Or, you can have the XML nodes be content of the script files.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




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