Announcement

Collapse
No announcement yet.

Independent Entities

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • meldavia
    replied


    The compiler there is no formal way of hiding any namespaces, and inherited files are all part of the global name space.
    There is a couple of ways to tackle this, first is to have a main program running from FLASH which contains all you main arrays and variables,
    and call up sub functions from disk, passing pointers to the variables in the parent program.

    If you just need to hide same name variables in functions, you can use private variables (which are still in the global space,
    but act similarly to a static variable in C). The main difference here is that they are still addressable from other functions if required,
    you just prepend the variable name with the function name followed by a 'dot'

    eg

    func myfunc()
    var private count;
    var provate colour;
    ......
    endfunc

    Then those variable are accesible from other functions like:-
    myfunc.count++;
    c := myfunc.colour;

    Leave a comment:


  • kt88pppamp
    started a topic Independent Entities

    Independent Entities

    For a custom interface I am writing, I need to know if it is possible to create independent entities of functions and global variables.

    I want to create a file with a few functions and have a group of variables only visible to those functions, not the whole program. Is this possible?

    Do you do this by making a library?
Working...
X