Page 1 of 1

Component Function

Posted: Sat Apr 26, 2014 7:47 am
by Kjell
:idea:

In case you don't like the syntax of calling a component, you can write your own classic C-style wrapper function using the ZLibrary component.

For example, when you want to delete a model using the RemoveModel component, you currently have to write the following expression.

Code: Select all

@RemoveModel(Model: myModel);
However, using a ZLibrary you can make this as follows.

Code: Select all

removeModel(myModel);
The only thing you have to do is to add a ZLibrary component containing the following function declaration in App:OnLoaded.

Code: Select all

void removeModel(model m)
{
  @RemoveModel(Model: m);
}
K

Posted: Sat Apr 26, 2014 4:37 pm
by VilleK
Nice :). Similarly you could make saveToFile(filename,array)/loadFromFile functions that encapsulates File components etc. We could wrap it up in a "Useful" lib and add it to the Library.xml.