Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    149
  • comments
    510
  • views
    94988

Integer arrays

Sign in to follow this  
noaktree

86 views

I have a headache...

I am now calling my scripting language A2 ("A squared") after my city. It now supports integer arrays which can be used in the following ways:

int x[expression;]; // Creates an integer array of size determined by expression.
int x[expression;] = {expression; ...}; // Creates an array as above but sets each value with expressions
int x[expression;] = integer array; // Creates an array from another array.
int x[expression;] = function (internal or external) that returns an integer array;
x[expression;] = integer expression;
x = {expression; expression; ...}; // Array elements can be redefined all at once.
int y = x[expression;];
print x; // Example 5 3 77 4 3
print x[expression;]; // Prints a single element


Arrays can be passed as parameters and return types by declaring a function like so:

function int[] flable (int Array1[], int Array2[]);

Memory is managed and element access is range checked.

I hope to have a first version up by next week. Next I'll need to refactor my function parsing class. There are some redundant operations in there and it's getting too big for a single source file. Hopefully the other types will go in faster now that I have a basic framework working for data types. We will see.
Sign in to follow this  


2 Comments


Recommended Comments

Quote:
Title of the Journal

"Journal of noaktree: Noaktree Leaves"


When are you leaving

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!