The PRJ library is meant to be a simple library to get a list the functions of files in your a component.
Though PRJ is a simple library there are concepts that we will break down in this document to explain how it works.
...
Expand | ||
---|---|---|
| ||
Here is the function in its entirety:
Line 2 - This line shows the use of a https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/2697166850/for+each+loop. In this case, Line 4 - This line checks if the current entry is a directory using the value returned by the iterator function ( Line 6 - This line shows the concept of Recursion in Lua. Recursion is a programming concept where a function calls itself during its execution. In this case, if it's a directory, the function recursively calls itself ( Line 9 - This line shows if it is not a directory it must be a file, so the file name is added to the list (
So, the entire line is a shorthand for adding an element to the end of a Lua table, simulating an "append" operation commonly found in other programming languages. It's a common idiom in Lua when you want to build a list dynamically. For example, if |
...