Skip to main content
Discovery icon for Minecraft Computer Mods Discord server

Minecraft Computer Mods

2,588 Online
7,346 Members
# computercraft3 people

modifying rs.getSides function

A proposed Lua code snippet that attempts to temporarily modify `rs.getSides` to include a modem in the list of sides backfires due to polluting the global `rs` table.

  • The initial code snippet tries to wrap `rs.getSides` to add a modem to the returned sides, then restore the original function, but this approach pollutes the global `rs` table.
  • The `gps.locate` function would still locate the computer itself, not the modem, if the original `rs.getSides` were simply modified by adding the modem to its output.
  • A corrected snippet aims to avoid polluting the global `rs` table by only adding the modem to a local `sides` table and then removing it after `gps.locate` is called.
  • It was realized that even the 'corrected' snippet mistakenly modified the local `sides` table for `gps.locate` instead of the global `rs` table, leading to confusion.
Summarized from recent messages, might be inaccurate

More conversations

Talk, Play, &
Hang Out

Find your space to hang out, discuss the latest updates with the party chat, and see who's down to join your next match.
Get App