• 0

    posted a message on Galaxy Scripting

    No dynamic allocation

    Can't seem to allocate new objects on the fly. There is no such things as malloc or new.

    I tried to get the pointer from a local variable but it gets killed when leaving the function:

    struct test {
      int i;
      int j;
    };
    
    test* createTest() {
      test o;
      o.i = 5;
      o.j = 1;
      return &o;
    }
    
    void Init() {
      test *object = createTest();
      object->i;
      // Invalid stack pointer
    }
    

    No Object Copy

    If you want to copy an object, you have to do it by hand.

    test A = createTest();
    test B = A;
    // This field is not a member of the struct type
    test *B = A;
    // Bulk copy not supported.
    

    Casting

    There is no casting allowed

    void *a = createTest();
    // No implicit cast allowed
    void *a = (void *)(createTest());
    // Syntax Error: No explicit cast allowed
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on SC2 API Documentation

    I am currently leading the SC2 API Documentation effort and this post is going to be the place to talk about it. http://kb.sc2mapster.com/sc2-api/

    What has been achieved so far:

    Functions

    http://kb.sc2mapster.com/sc2-api/functions/

    Types

    http://kb.sc2mapster.com/sc2-api/types/

    • The type list is done

    What need to be done:

    Functions

    • The function list has been somewhat organized but it's still quite messy.
    • Only few functions are documented so far. Need to document more.
    How to document

    In order to document, just copy the source of an already documented function and customize it. Once you are done, add the little description next to the documented function in the list.

    Make sure you have at least one example! This is the most important part. If you have questions about the function, do not hesitate to post a comment right after.

    Type

    Everything is to be done

    Thanks!

    Posted in: General Chat
  • To post a comment, please or register a new account.