Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wirelinks Return Empty Table and Cannot Be Written To or Read From #1577

Closed
LengthenedGradient opened this issue Dec 17, 2023 · 2 comments
Closed

Comments

@LengthenedGradient
Copy link
Contributor

Wirelinks in Starfall seem broken. I tried using wiring a cam controller to the chip and refreshing. The result is always an empty table. When printing a specific wirelink output, the result is always nil.

--@name
--@author
--@server

wire.adjustPorts({Ent="entity"})
local ent = wire.ports.Ent
printTable(ent:getWirelink())

I am up to date with starfall EX's main branch (tested in SP). I'm not sure the version but I also tested on MP with the same result.

I am not sure but I am guessing it might be related to:
wiremod/wire#2891
wiremod/wire#2942

@LengthenedGradient
Copy link
Contributor Author

Never mind, my wire was out of date. Apologies for the inconvenience.

@adamnejm
Copy link
Collaborator

The result is always an empty table

Wirelink doesn't have custom __printtable implemented, see here.

However everything seems to be working:

--@name Generic
--@author Name
--@server

local owner, client, chip, world = owner(), player(), chip(), entity(0)

-------------------------------------------

local indicator_sent = prop.createSent(chip:getPos() + chip:getUp() * 20, chip:getAngles(), "gmod_wire_indicator")

wire.adjustPorts({ Indicator = "entity" })
wire.create(chip, indicator_sent, "Indicator", "entity", 1)

local indicator_wl = wire.ports.Indicator:getWirelink()
timer.create("Blink", 0.5, 0, function()
    local current = indicator_wl:inputValue("A")
    indicator_wl.A = current == 1 and 0 or 1
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants