How can I access the main script’s function from the instantiated script?
If I use “Main : main = main{}” in the script on the instantiated side to create an access route to the main side as shown below, a compilation error will occur.
shown error:
Linker task graph contains a cycle:
Versecompiler ingo: Unable to assemble “script name” (SDO instantiantion, etc,)
###############
Main Scripit
###############
main := class(creative_device):
@editable
Sub : sub = sub{}
function1(Agent:agent):void=
block:
###############
instantiated Script
###############
sub := class<concrete>:
Main : main = main{}
function2(Agent:agent):void=
Main.function1()
Thank you for your promptness
I was running away from like ”Self” and not studying properly.
It seems difficult, but I will try to analyze it properly.
Self returns the current instance of the class you’re calling it from. (also called an object in all programming languages)
In your case, calling Self inside the main class will return the actual main device. (which eventhough it’s called main, could be instanced many times, each one would be different but Self would return each of these instances every time it’s called)
But maybe I’m not clear enough, just lookup classes and objects in programming