As the title states, I am trying to put a component in a variable for faster runtime as I assume that a single call is cheaper than calling it every time.
Unless this is irrelevant in opencomputers (of which i have no idea)
Most of this code has been copied over from computercraft but it should work. I just dont know how to save a component to variabele since what I am doing doesnt seem to work.
EDIT: also calling a function this way (bridge.sync) when i replaced bridge with component.openperipheral_bridge that did not work either -> attempt to index global 'component' (a nil value)
i replaced sleep with os.sleep since that seems to be the correct way to type it. I tried to replace bridge.sync with component.invoke(component.openperipheral_bridge.address, sync) but that also did not work...
I tried using the exact same code I typed in the first function in the lua interpreter and that worked, sadly in the script i wrote it doesnt...
The left was before the edit, the right is current version. (and the error message is upon running the most recent version)
I'm sorry for the messy question, I hope you can help...
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
As the title states, I am trying to put a component in a variable for faster runtime as I assume that a single call is cheaper than calling it every time.
Unless this is irrelevant in opencomputers (of which i have no idea)
Most of this code has been copied over from computercraft but it should work. I just dont know how to save a component to variabele since what I am doing doesnt seem to work.
EDIT: also calling a function this way (bridge.sync) when i replaced bridge with component.openperipheral_bridge that did not work either -> attempt to index global 'component' (a nil value)
i replaced sleep with os.sleep since that seems to be the correct way to type it. I tried to replace bridge.sync with component.invoke(component.openperipheral_bridge.address, sync) but that also did not work...
I tried using the exact same code I typed in the first function in the lua interpreter and that worked, sadly in the script i wrote it doesnt...
The left was before the edit, the right is current version. (and the error message is upon running the most recent version)
I'm sorry for the messy question, I hope you can help...
Link to post
Share on other sites