Subpograms

Feature requests for future versions of Hollywood can be voiced here
Post Reply
ilbarbax
Posts: 112
Joined: Thu Apr 01, 2010 6:41 pm

Subpograms

Post by ilbarbax »

Hi,

May be already exists and I'm putting a silly question....

I faced some problems in handling indipendent portions of program by taking care to the variables used, cleaning memory delete brushes, sprites etc.

I think could be very usefull to have statement like Function, but with the big difference that when exing from it all variables, graphics elemets etc used by this function are automatically deleted.

Sandro
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Subpograms

Post by jalih »

ilbarbax wrote:I think could be very usefull to have statement like Function, but with the big difference that when exing from it all variables, graphics elemets etc used by this function are automatically deleted.
Hello Sandro,

Just declare your variables as Local inside the Function, otherwise Hollywood defaults to Global variables.

Local variable:

Code: Select all

Local x = 0
Global variable:

Code: Select all

x = 0
Post Reply