Can I InsertItem Key=Value pair?

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Can I InsertItem Key=Value pair?

Post by Bugala »

I am trying to figure out a way to put key=value pair to a table preferably using InsertItem command.

what I am after is basically:

Code: Select all

table = {
  ["key1"] = "string1",
  ["key2"] = "string2"
           }

Because all Keys are unique, I could do it simply using:

Code: Select all

table[key] = value
But just for style and consistencys sake, i would prefer using InsertItem command for it. Is there any way to do it with it, for i cant figure out a way to do it.
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Can I InsertItem Key=Value pair?

Post by SamuraiCrow »

No, you can't. If you look in the documentation before posting you'd see that it's only for arrays. Arrays in Hollywood are just tables with numeric keys only. If you are using a regular table with arbitrary keys it will not work! Try looking at RawSet or else use your own wrapper procedure.
I'm on registered MorphOS using FlowStudio.
Post Reply