Couple things here...
<cfset setSettings(structAppend(getSettings(), { "hello" = "world" })) />
Settings is a struct
but structAppend()
returns a boolean. Do your struct appending before this line. Second, structs are always passed by reference, meaning, if you do getSettings()
you get a struct
, which you can make changes to. Another call to getSettings()
will return the same struct
with the updated settings.
All you need is this:
<cfset structAppend(getSettings(), { "hello" = "world" }) />
One last thing. You could be getting a null pointer exception because getSettings()
starts uninitialized. In your cfc, in the constructor area (after your properties), you should set an initial settings struct
, like this:
<cfset setSettings({}) />