You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 18
Next »
So you’re writing an interface and you make some useful routines and then you realize that you’d like to use this library in other components.
How do you do this?
You can create libraries which are then re-usable from any other Iguana X component.
Step 1: Add a component using green [+COMPONENT] button
If you need a reminder Create a Component
Step 2: Make sure it has an upstream repo
Step 3: Create a directory FOO
Click the Create Folder icon
Enter the folder name and click and click the green [CREATE] button
You should see something like this:
Step 4: Create a file BAR.lua in the FOO directory and add a function
Select the Create File menu optin on the FOO folder
Enter the folder name and click and click the green [CREATE] button
Create a function in the BAR.lua file, you can paste this example:
function FOObar()
return "The world needs more FOO";
end
You should see something like this:
Step 5: Commit the changes and push them to the upstream repo
Click the Commit changes toolbar button
The commit dialogue will open, enter a commit message and click the green [COMMIT] button
Click the Push changes to remote toolbar button
The upstream repository will look something like this:
NOTE: FOO is currently just a folder
Step 6: Convert FOO to a library by right clicking on it and choosing the "Create Library" menu option
Open the folder menu by right clicking on FOO, or clicking the 3 dot menu
Choose Create Library to convert the FOO folder into a Library
Click the green [CREATE] button in the confirmation dialogue
This will bring you to the Repository Management dialogue
Once you are in the Repository Management screen you can set your upstream repository
Step 7: Commit and push the FOO library changes
See Step 5 for detailed screenshots (the first three steps below are the same)
Click the Commit changes toolbar button
The commit dialogue will open, enter a commit message and click the green [COMMIT] button
Click the Push changes to remote toolbar button
The component upstream repository will look something like this:
NOTE: Notice that FOO was converted from a folder (in step 3) to a reference to the FOO library
The FOO library upstream repository will look something like this:
NOTE: That the the FOO library should have the BAR.lua file in it.
Step 8: Now import the FOO library into another component using the FOO library URL
Get the FOO library URL
Edit the target component in the Translator
Click the Add library button to open the Import Library dialogue
Enter the FOO library details in the LIBRARY DETAILS section of the Import Library dialogue
Type in the library name FOO
Paste the URL you copied above into the GIT url field
Click the green [IMPORT] button to import the library
Screen Recording 2023-11-10 at 18.46.24.mov
Step 9: Optionally add the FOO library to a collection
You can also add your libraries to a collection so they will show up in the Import Library dialogue list.
Choose the Add to Collection option from the right click menu
Choose an existing collection or create a new collection in the Add to collection dialogue
In this example I will choose an existing collection Test Lib collection
This will open the Edit Collection dialogue for the chosen collection
Here I can edit the details for libraries in this collection
In this case I will just update the description for FOO
Click the green [SAVE] button to add the new library
Now when I open the Add Library dialogue and filter for FOO it is there in the list