Hi. How to access a nested folder’s module in Verse?
For example, if I want to access a module in Sub3.verse placed in the Sub1/Sub2 folder, how should I write the using clause?
Unfortunately, the code below did not work.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { Sub1}
using { Sub2} #Invalid access of internal module `(/localhost/MyProject230520/Sub1:)Sub2`
using { Sub1.Sub2} #Invalid access of internal module `(/localhost/MyProject230520/Sub1:)Sub2`
using { Sub3} #Unknown identifier `Sub3`.(3506)
using { Sub1.Sub2.Sub3} #Unknown member `Sub3` in `Sub2`.(3506)
using { Sub1.Sub3} #Unknown member `Sub3` in `Sub1`.(3506)
testDevice1 := class(creative_device):
OnBegin<override>()<suspends>:void=
Print("test")
Hey, did you manage to resolve this in the end? I’ve seen it working for others but I get the ‘Invalid access of internal module’ no matter what I seem to try.
When you create a subfolder in a verse project, the verse compiler creates a module with an implicit <internal> access specifier. Because of the implicitinternal you cannot access the submodule from outside the outer module.
The directory structure Sub1/Sub2/Sub3/SomeClass.verse is equivalent to
So, it is not possible to have a structure of folders like Sub1 → Sub2 → Sub3.verse
and use Sub3.verse from outside Sub1, because Sub2 is internal?
As I understand your solution is to declare a Sub2.verse , but then you will not have a Sub2 folder and instead you will have a file for that module
I can’t get this to work. When I create a file modeled entirely on your first example, it still throws an error in both VSCode and the UEFN editor. I want to define a device then use it as an editable, but apparently this is illegal. I understand the desire to clean up code by binding submodules to the filesystem locations, but not having clean class definitions to work with is - in my humble but currently furstrated opinion - not ideal.
Edit: Figured this out. Made my device definition public. My irritability about module access structure being invisibly bound to directory structure stands.
This seems very inconvenient. If I copy a nested folder to another project I have to create another file (or copy) that exposes the module.
This brings the question why modules aren’t public by default? In other languages (C#, C++) namespaces are public and don’t have access specifiers at all.
This is really inconvenient for organizing a good file structure within my map, for seemingly no reason… Is there any plans to change this in the future?