TatCustomScripter.AddLibraryInstance Method
Registers an already-instantiated library object in the scripter. Prefer AddLibrary for normal use.
Remarks
AddLibraryInstance adds a new library to be available in scripter. You should rarely use this method, call AddLibrary instead. AddLibraryInstance requires an already instantiated TatScripterLibrary object, to be passed in ALibrary parameter. AName must contain the name which the library instance will be accessible (e.g., if AName is "MyLibrary", you access library methods and properties with MyLibrary.MyMethod). Used only if AddMethod is true. ADefault parameter indicates if the library methods and properties will be accessible from all scripts without needing to use the library name prefix. For example, if ADefault is true, you can directly access MyMethod from script, without needing to use MyLibrary.MyMethod. AddMethod allows you to access library methods and properties as if the library was an object. The object name is specified by AName parameter. (e.g., if AddMethod is true and AName is "MyLibrary", you access library methods and properties using MyLibrary.MyMethod). LibName is the name of the class of the library. You can use it, for example, when the library has class methods. If LibName is empty, the name of the Delphi class will be used. For example, if the class of your library is TatMyLibrary, and LibName is empty, you can access class methods using TatMyLibrary.MyClassMethod. If LibName is not empty, for example, if LibName is "TMyNewLibraryClassName", then you can access class methods using TMyNewLibraryClassName.MyClassMethod. AddLibraryInstance calls the Init method of library to perform the registration of the library.
Syntax
Unit: atScript
procedure TatCustomScripter.AddLibraryInstance(ALibrary: TatScripterLibrary; AName: string; ADefault: Boolean = True; AddMethod: Boolean = True; LibName: string);
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| ALibrary | TatScripterLibrary | ||
| AName | string | ||
| ADefault | Boolean | Optional: Default value is True |
|
| AddMethod | Boolean | Optional: Default value is True |
|
| LibName | string |