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

Integer arrays

Sign in to follow this  


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  


Recommended Comments

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!