Author Topic: Object name nonsense  (Read 1145 times)

Run this code for a test:
Code: [Select]
%obj = new ScriptObject(object1)
{
    subObj = new ScriptObject(object2)
    {
        subsubObj = new ScriptObject(object3){};
    };
};
echo(%obj.subObj.getName());
It's gonna say object3. Why is this?

All three are named Object3.

My best guess, in pseudocode, as to why it's happening:

Code: [Select]
define obj as ScriptObject
set name to object1
    define subobj ScriptObject
    set name to object2
        define subsubobj as ScriptObject
        set name to object3
        apply name to object
    apply name to object
apply name to object

I can only imagine how painful the debugging situation was that lead to this discovery.