Jump to content

problem with (broadcast-)invokeClientfunction


Laserzwei

Recommended Posts

When using either broadcastInvokeClientFunction or invokeClientFunction and sending tables as payload, there can occur the following crash:

2018-02-17 16-48-26| could not execute function 'send' in '"mods/invtest/new.lua"':

2018-02-17 16-48-26| stof

2018-02-17 16-48-26|    [C]:-1: in function invokeClientFunction

2018-02-17 16-48-26|    mods/invtest/new.lua:23: in function ?

2018-02-17 16-48-26| Setting state to invalid.

The error is reproducable in 0.16 and 0.15.8 (not tested earlier, but most likely also present there).

Affected are all lists, where string- AND number-keys are used. Specifically only if these "mixed keys" are used in the very same list- Having a string-key only list with a nested number-key list is totally fine. Having a mixed-keys list somewhere nested within the payload will throw said error.

 

lists that are fine (divided by underscores):

li[1] = 1
li[2] =  "a"
________________
li[1] = 1
li[20] = "a"
________________
li[1] = 1
li[math.huge] = "a"
________________
li[1] = 1
li["2"] = "a"
________________
{1,2,{vec3(4,5,6), vec2(1,2)}, "test", ["10"]=1}

 

lists that don't work:

data[1] = {["name"] = "Name1", [1] = 2}
data[2] = {["name"] = "Name2", [2] = 2}
________________
data[1] = 1
data["a"] = "b"

 

While testing some of the lists I noticed a 2nd most likely related unexpected behaviour/bug:

When sending:

li[1] = 1
li[20] = 2
li["4"] = 3

The client will not receive      li["4"]

 

When sending:

li[1] = 1
li["4"] = 3
li[20] = 2

the client will receive:

li[1] = 1

li[4] = 2

li[20] is missing and li[4] has the wrong value!

There is some serious weirdness going on

 

 

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...