Skip to content

Throw exceptions when using disabled peripherals #755

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

Open
wants to merge 5 commits into
base: dev/1.19.2
Choose a base branch
from

Conversation

zyxkad
Copy link
Collaborator

@zyxkad zyxkad commented Jun 29, 2025

  • add DisabledPeripheral
  • fix peripherals

PLEASE READ THE GUIDELINES BEFORE MAKING A CONTRIBUTION

  • Please check if the PR fulfills these requirements
  • The commit message are well described
  • Docs have been added / updated (for features or maybe bugs which were noted). If not, please update the needed documentation here. Feel free to remove this check if you don't need it
  • All changes have fully been tested
  • What kind of change does this PR introduce? (Bug fix, feature, ...)

  • What is the current behavior? (You can also link to an open issue here)

  • What is the new behavior (if this is a feature change)?

  • Does this PR introduce a breaking change? (What changes might users need to make in their scripts due to this PR?)

  • Other information:

For disabled peripherals, it will have an additional peripheralDisabled method which always returns true. And all other operations will throw LuaException.

An example for people want to detect if a peripheral is disabled will be:

local chatbox = peripheral.find('chatBox')
if chatbox.peripheralDisabled then -- invoke the method is not necessary since it will always return a true
  printError('chat box is disabled!')
end

Copy link
Contributor

github-actions bot commented Jun 29, 2025

Build Preview

badge

You can find files attached to the below linked Workflow Run URL (Logs).

Name Link
Commit 23d989c
Logs https://github.com/IntelligenceModding/AdvancedPeripherals/actions/runs/15975732878

@zyxkad zyxkad marked this pull request as ready for review June 30, 2025 14:27
@zyxkad zyxkad requested a review from SirEndii June 30, 2025 14:29
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

Successfully merging this pull request may close these issues.

1 participant