Hi,
Is it possible to refer to the path of an object via a string? The
problem is trying to set a value within an object while containing the
object name in a variable.
OK, that was not very well explained, but using the definition of 'color
below, is it possible to change color/blue/dark using three strings
"color" "blue" and "dark" ?
- Chris
>> color: make object! [blue: make object! [dark: "midnight"]]
>> ps-blues: to-set-path [color blue dark]
== color/blue/dark:
>> ps-blues "ocean"
== "ocean"
>> ? color/blue/dark
"ocean" is string
>> ps-blues: to-set-path "color/blue/dark"
== color/blue/dark:
>> ps-blues "ocean"
** Internal Error: ** Script Error: color is not defined in this
context.
** Where: arg1
>> set in to-path "color/blue" to-word "dark" "navy"
** Script Error: in expected object argument of type: object.
** Where: set in to-path "color/blue" to-word