Need Help with Sub-Folders

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Need Help with Sub-Folders

#1 Post by The Artful Dodger »

Hello:
I have a small problem which I hope has a solution. Here's an example:

Code: Select all

	Logic.lua
            |
            -------
                  |
               lib_Prog
                  |       
               Folders
                  |
                  -------
		        |
                   Sub-Folders
                        |
                        -------
                              |
                            Files
From logic.lua, I can call lib_Prog. But, from lib_Prog, what nomenclature do I use to call a function in the level marked "Files"?
I would appreciate your help!

Sparky

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Need Help with Sub-Folders

#2 Post by Ralph »

I'm not really sure what you mean, what's lib_Prog?

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Need Help with Sub-Folders

#3 Post by The Artful Dodger »

Hi, Ralph:

That's just the lib_xxx.lua program that is normally called by logic.lua.I was trying to show a folder structure where there is a level below the lib folder. And a function in a file in a folder on this lower level that I need to call. After I wrote this question I think I found that I need to use a "require" statement, but I'm not sure if you have disabled it?

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Need Help with Sub-Folders

#4 Post by Ralph »

There's no possibility for sub folders in the lib directory as far as I know, only in the resources folder.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Need Help with Sub-Folders

#5 Post by The Artful Dodger »

Hello, again, Ralph:
May I ask an impudent question, at least it may seem Impudent (first time I've ever used 'Impudent' twice in the same sentence nor thrice in the same paragraph!) to some!
There's no possibility
because LUA doesn't allow it or because Sim Innovations doesn't allow it? Kind of like file I/O isn't 'allowed', although for the life of me I can't see why not - there's your firewall preventing me from "mucking" around in your files!
I ask that question because LUA obviously allows it because you said that it's allowed
only in the resources folder.
I just need to learn the way to do it!
Thanks again.

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Need Help with Sub-Folders

#6 Post by Ralph »

Because we do not allow it, Air Manager does not scan any subfolders within the lib folder, only within the resources folder.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Need Help with Sub-Folders

#7 Post by The Artful Dodger »

Does that mean that you have disabled LUA from referring to other folders or AM simply doesn't do it automatically. Because if you have prohibited LUA from doing it, it means that, unless you are willing to grant me an exception, I have just wasted about 6 months of work!!

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Need Help with Sub-Folders

#8 Post by SimPassion »

The Artful Dodger wrote: Fri Mar 31, 2023 9:35 am Does that mean that you have disabled LUA from referring to other folders or AM simply doesn't do it automatically. Because if you have prohibited LUA from doing it, it means that, unless you are willing to grant me an exception, I have just wasted about 6 months of work!!
The point is this feature have been disabled already from years ago ...

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Need Help with Sub-Folders

#9 Post by Ralph »

It doesn't have anything to do with accessing folders, it is just that any Lua file other than directly in the lib folder, isn't loaded.
I don't really see the issue, it is just a matter of having all your Lua libs in the lib folder. It doesn't require any changes in your script at all.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: Need Help with Sub-Folders

#10 Post by The Artful Dodger »

Hello, Ralph:
Regarding your last statement, it just isn't true. The software I would be adding is the Working Title Update 12 complete autopilot. It may not work, but with this situation, I will never know. I have converted the software from Typescript to LUA. It is organized on two folder layers and it can't be placed in one folder. So, I may be forced to abandon AM, and that would be a shame all due to an arbitrary decision that one folder was enough! I hope that Sim Innovations will reconsider.

Post Reply