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

Bigger Reactors #7

Open
PedroAugusto1907 opened this issue Jun 15, 2023 · 3 comments
Open

Bigger Reactors #7

PedroAugusto1907 opened this issue Jun 15, 2023 · 3 comments

Comments

@PedroAugusto1907
Copy link

Hi! I'm having this error
image (6)
when try to connect Bigger Reactors
Installer: https://pastebin.com/MiwX1rFf
Controller: https://pastebin.com/KJwPLGWa
Sorry for my bad english and thanks for your attention.

@jdf221
Copy link
Owner

jdf221 commented Jun 15, 2023

Will take a look at this when I get home later. Odd error...

@jdf221
Copy link
Owner

jdf221 commented Jun 15, 2023

Ok I found the issue. Bigger Reactors provides peripheral API methods that return objects that contain functions.

Rednet/wireless modems only support text transfer, so when you call a method on the peripheral and it returns for example {getPowerLevel=function, getChargeRate=function} WPP tries to convert that whole object into a string to send it over Rednet. Obviously that's not possible since you can't convert a function to a string.

Don't have the time tonight to fix it but I have an idea for how to fix it. Either going to create a "cached mapping" of returned functions and assign an ID to each function. Or I'll just have the functions recall their parent peripheral method each time they're called.

2nd way isn't ideal (because recalling the parent method could cause side effects) but I'm leaning towards it because the 1st way would create a permanent "cache" that would never be garbage collected (or whatever goes on in LUA lol) and could become an issue since WPP is meant to be ran indefinitely.

Will work on it tomorrow.

jdf221 added a commit that referenced this issue Jun 16, 2023
@jdf221
Copy link
Owner

jdf221 commented Jun 16, 2023

Ok @PedroAugusto1907 give this new version a try:

wget https://raw.githubusercontent.com/jdf221/CC-WirelessPeripheral/jdf221-patch/wpp.lua?token=noCachePls wpp

I haven't tested it with the actual Bigger Reactors mod so no clue if it'll work lol. I don't love how the code turned out but hopefully it'll work for you.

You will need to update the "wpp" script on all of your computers.

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