Jesus4Lyf
Good Idea™
- Reaction score
- 397
I've been trial and erroring, slowly building up enough information to start writing systems in SC2.
This is the syntax for array declaration and usage, demonstrated by writing an allocator/deallocator. I don't think this will be necessary if structs are all they're cracked up to be, but we'll see.
Code is tested and compiles.
This is the syntax for array declaration and usage, demonstrated by writing an allocator/deallocator. I don't think this will be necessary if structs are all they're cracked up to be, but we'll see.
JASS:
int[128] MyStack__Stack;
int MyStack__Stacked=0;
int MyStack__Next=0;
int MyStack__Alloc(){
if (MyStack__Stacked==0){
MyStack__Next=MyStack__Next+1;
return MyStack__Next;
}
MyStack__Stacked=MyStack__Stacked-1;
return MyStack__Stack[MyStack__Stacked];
}
void MyStack__Dealloc(int ev){
MyStack__Stack[MyStack__Stacked]=ev;
MyStack__Stacked=MyStack__Stacked+1;
}
Code is tested and compiles.