Description
What is a cached Instance? Does that exist?
No, I don’t think it does in a DataModel. But if you :Clone()
an Instance, at least then you’d have a copy of it with a snapshot of all Instances that were a child of it, at the time you cloned it.
If you’re returning an Instance, like game.ReplicatedStorage.Folder
through a ModuleScript, that essentially is a “path” and not a clone…
There’s no autocomplete for it.
But… the ClickDetector
. It’s right there. And both are the same instances!!
Re-production Steps
This happens in the Old and New Solver
-
Inside
ReplicatedStorage
create aFolder
and put whatever you’d like into it.
-
Create a ModuleScript where ever you’d like.
-
Put this inside the ModuleScript
Script
local module = {}
module.An_Instance = game.ReplicatedStorage.Folder
return module
- Make sure to click “Reload Script” at the top area in Studio!
- Create a Script
- Put this inside the Script
Script
local test = require(game.ServerStorage.ModuleScript)
local REAL_INSTANCE = game.ReplicatedStorage.Folder
- Now go to
game.ReplicatedStorage.Folder
- Put more things into the Folder.
- Go back to the Script and try to autocomplete
REAL_INSTANCE
andtest
Expected Result
If it’s an Instance, I thought I will always get the autocomplete, even if I put new Child Elements into the Instance.
I am NOT:
- Returning a
:Clone
- Nor returning
Instance.new()
I am returning a full path to an Instance. But, does Luau understand what a path to an Instance is?
Actual Result
If I made a ModuleScript that contains module.An_Instance = game.ReplicatedStorage.Folder
, or returns an Instance in any way. It seems to memorize all the things the Instance contained at that time, once you click “Reload Script”.
This is persistent until you refresh Studio or re-reload the ModuleScript.
If I add new Child Elements to the same Instance that I returned, it is not going to update it, while a true variable does update it.