(Bindable Function) Dictionary Transfer Problems

Since the scripts are kind of long i’m going to try and summarize their usage

I have two different scripts: Call them Script A and Script B

What happens is:

  • Script B asks for a dictionary from Script A (Bindable Function btw)
  • Script A returns the dictionary, no problems yet
  • Script A changes up the dictionary (with table.insert and that stuff)
  • Script B Asks for the dictionary again, the value retrieved from Script A does not change (it’s the same as when Script B asked for the dictionary the first time)

The only thing Script A does when returning the dictionary is below

local function BindableFunctionThing()
   return dictionaryName
end

Can you confirm that in Script A, you are changing the same table as the one which you are returning in the bindable function callback? Also (assuming you’re not using the beta output system) you might want to print out the table addresses in Script A and B to compare that they are the same table.

Yea, I am changing the same table in Script A. The table addresses seem to be different in Script A and B though

I just checked and I guess bindable functions also clone return values, so the table in B is a deep copy of the table in A. I’m not sure why you wouldn’t see a change in the table if you invoked the bindable function again though, because I would assume it would deep copy the current state of the table in A. If you are also accessing the table in script A via the bindable function its possible the table you are changing is not the one being returned, thus not the one being deep copied.

1 Like

I have prints when the modified table is sent from Script A to B, and when Script B receives the table.
For some reason the print from Script A most definitely has the modified data/table, but the print from Script B when the table is received is completely different