@PMunch , Thank you for your kindness, I think I understand, finally when in my table I declared the object, I made a copy like this : var testTable = initTable[string, myObj]() # First approach declared the whole object proc initTableObj (): cint = # ... testTable["key1"] = obj return 0 Run
Now if I define my `obj` as a global variable, it works var testTable = initTable[string, ptr myObj]() # Second approach declared the object address var obj: myObj # define global variable proc initTableObj (): cint = # ... obj = newObj() # Set object testTable["key1"] = obj.addr return 0 Run The problem now is that I can't create several different objects, since `obj` is declared as global : testTable["key1"] = obj.addr # initTableObj () testTable["key2"] = obj.addr # initTableObj () Run If I want to retrieve `key1` , I end up with the values of `key2` Do you have a suggestion?