nanos-world / issues

Issue Tracker for nanos world
9 stars 1 forks source link

WebUI:CallEvent varargs issue #980

Closed Timmy-the-nobody closed 11 months ago

Timmy-the-nobody commented 11 months ago

Prerequisites

Your Environment

Description

When passing varargs into a lua to WebUI event all the subsequent parameters that follows a nil parameter are nullified

Steps to reproduce the behavior

Lua:

local UI = WebUI("", "http://localhost:3000")

local function someFunction(...)
    UI:CallEvent("SomeEvent", ...)
end

Timer.SetTimeout(function()
    someFunction("a", nil, "c")
end, 1000)

JS:

Events.Subscribe("SomeEvent", (a, b, c) => {
    console.log(a, b, c); // output: "a undefined undefined"
});

Expected behavior

A nil parameter shouldn't nullify or affect the subsequent parameters in the varargs list when sent to javascript

Actual behavior

A nil parameter nullifies the subsequent parameters in the varargs list when sent to javascript

gtnardy commented 11 months ago

hey, I'm not sure what you have in your http://localhost:3000, but I couldn't reproduce it:

  WEBUI  [webui] [WebUI#2147483650] a null c (file:///D:/UnrealEngine/UE_5.3/Engine/Saved/Packages/127.0.0.1/testing/Client/UI/index.js:2)

it does output each value properly

Timmy-the-nobody commented 11 months ago

hey, I'm not sure what you have in your http://localhost:3000, but I couldn't reproduce it:

  WEBUI  [webui] [WebUI#2147483650] a null c (file:///D:/UnrealEngine/UE_5.3/Engine/Saved/Packages/127.0.0.1/testing/Client/UI/index.js:2)

it does output each value properly

I had a problem in a specific case and made the snippet to reproduce it without testing, I legit thought it would have the same result, sorry In the meantime I opted for a different way of sending data in this case, so if I manage to reproduce it, I'll make sure to double-check all the steps performed to get this result and test the reproducible snippet before adding it to the github issue next time

Feel free to close this one, as there's a very good chance it was due to a problem on my end.

gtnardy commented 11 months ago

perfect, thanks, let me know if you get anything new!