This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
speed150mph's profile picture

Lua information language ---> English translation?

Started by speed150mph, 31 March 2014 - 11:54 PM
speed150mph #1
Posted 01 April 2014 - 01:54 AM
Okay so im messing around using the new big reactors mod with the computer port. all of the reactor commands are in lua so I am using the lua program. for those who don't recognize my user name, im a bit of a dunce when it comes to programming but im a stubborn dunce who keeps trying lol. anyway I figured out how to type in the commands but I cannot understand the answers when I try to get information. heres an example of a series of commands I used and their answers.


reactor = peripheral.wrap("back")
reactor.getControlRodName
"function: 1e1b8e6"
reactor.getControlRodLevel
"function: 51a2061"


for your information, here is a link to the wiki page for the computer control port with a list of the lua commands and other pertinent information. http://wiki.technicpack.net/Reactor_Computer_Port#Lua_Methods_.280.3.29

so obviously this isn't telling me what information I want to know, or rather its not showing me the info in a way I can easily understand. so how would I get the computer to tell me for example that the control rod level was 40% (which it was while I was conducting this trail)

sorry for asking what to some will probably be a simple question, but id really like to know. thank you :)/>/>/>
Bomb Bloke #2
Posted 01 April 2014 - 02:27 AM
For eg, to use "getControlRodName", you might do something like:

local reactor = peripheral.wrap("back")

local firstControlRodName = reactor.getControlRodName(1)

See this guide for more general information on using peripherals.
speed150mph #3
Posted 01 April 2014 - 03:27 AM
all I get from your code when I try it is
"controlrodname:2: 1

In the reactor itself, I named the control rod "control rod" so why doesn't it work. im so confused..
speed150mph #4
Posted 01 April 2014 - 03:47 AM
Okay I figured it out. the control rod index starts at 0, so since I only have one control rod, that rod is referenced as rod 0. thank you for your help :)/>
Edited on 01 April 2014 - 01:51 AM
blipman17 #5
Posted 01 April 2014 - 09:37 AM

reactor.getControlRodName
"function: 1e1b8e6"
this returns a table, not a single variable.
see the textutils.tabulate() function if you want to see the content of the table.
Bomb Bloke #6
Posted 01 April 2014 - 09:53 AM
It seems speedy's already sussed it out, but just to be clear - that function returns a string, not a table. The reason he was getting the output he got was because he wasn't actually calling the function, but rather just typing its name into the Lua prompt.

Said prompt, when passed variables (such as "reactor.getControlRodName"), will output what's in them.