From 68693bb7b71bb5721bdda9dc16948b750ea71065 Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Fri, 18 Apr 2025 19:00:42 +0000
Subject: [PATCH] fix object accessing

---
 test_scripts/object.vs |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/test_scripts/object.vs b/test_scripts/object.vs
index 9b9ce5e..63526fb 100644
--- a/test_scripts/object.vs
+++ b/test_scripts/object.vs
@@ -1,36 +1,28 @@
 
 object $person = {
-    name: "Szoni",
-    double age: 37.6
+    string name: "Szoni",
+    int age: 37
 };
+
+printnl("Hello, ", $person->name, " your age is: ", $person->age);
 
 
 object $person2 = {
     string name: "Not Szoni",
     int age: 37,
-    object $children: {
+    object children: {
         string name: "Child1",
         int age: 10
     }
 };
+printnl("Person2: ", $person2->name, " age: ", $person2->age, " child: ", $person2->children->name, " age: ", $person2->children->age);
 
-object $children2 = {
-     string name: "Child2",
-        int age: 15
-};
+object $test = $person2;
+printnl("Person2: ", $test->name, " age: ", $test->age, " child: ", $test->children->name, " age: ", $test->children->age);
 
-object $family = {
-           $children: $children, // this is valid too
-    object $children: $children2
-};
-
-object $family3 = {
-    string age: 10  // this is invalid, drops error
-};
+string $person_name = $person->name;
+printnl("Person name: ", $person_name);
 
 
-
-printnl("Hello, ", $person->name);              // prints out: Hello, Szoni
-println("Type: ", typeof($person);              // prints out: Type: object
-println("Type: ", typeof($person2->name));      // prints out: Type: string
-println("Type: ", typeof($person2->age));       // prints out: Type: double
+printnl("Child1 old age: ",$person2->children->age);
+$person2->children->age = $person2->children->age + 2;

--
Gitblit v1.9.3