←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

test.lua: 6: attemp to call nil

Machallovnik's Photo Machallovnik 08 Oct 2015

Please help me
I use CC for monitoring Reactor


local mon = peripheral.wrap("monitor_1")
local reactor = peripheral.wrap("BigReactors-Reactor_0")
mon.clear()
mon.setCursorPos(1,1)
mon.setTextScale(2)
local Steam = reactor.getHotFluidProducedLastTick()
mon.write(Steam)
Quote

Creator's Photo Creator 08 Oct 2015

This means that the function getHotFluidProducedLastTick() does not exist in reactor.

Are you sure BigReactors-Reactor_0 is written like this and not BigReactorsReactor_0?
Quote

KingofGamesYami's Photo KingofGamesYami 08 Oct 2015

View PostCreator, on 08 October 2015 - 05:32 PM, said:

Are you sure BigReactors-Reactor_0 is written like this and not BigReactorsReactor_0?

I am. If he didn't wrap anything, he'd get an 'attempt to index ? (a nil value)'
Quote

Creator's Photo Creator 08 Oct 2015

So the first statement should be true.
Quote

KingofGamesYami's Photo KingofGamesYami 08 Oct 2015

Yes.
Quote

Dustmuz's Photo Dustmuz 08 Oct 2015

.getHotFluidProducedLastTick()
- that requires you to have a fluid intake and output (used to power a turbine usually) do you have this??
Edited by Dustmuz, 08 October 2015 - 07:00 PM.
Quote

Creator's Photo Creator 08 Oct 2015

Why would the existence of a function depend on whether or not there is fluid?
Quote

TYKUHN2's Photo TYKUHN2 08 Oct 2015

Creator he means a Fluid Intake block. The reactor is modular.
Edited by TYKUHN2, 08 October 2015 - 09:30 PM.
Quote

Creator's Photo Creator 08 Oct 2015

OK, I see.
Quote

Bomb Bloke's Photo Bomb Bloke 08 Oct 2015

It also requires BigReactors 0.3 or later.

http://wiki.technicp...r_Computer_Port
Quote

Dustmuz's Photo Dustmuz 08 Oct 2015

OP: if you can, could you suply us with a picture of your setup.

i've written multiple of these power management programs, as i use them to become better at lua, so each world i create, i start from scratch :D
think i have 40-45 of these on my pastebin :D
most problems with this kind of program lies in compability between mods :)
Quote

Machallovnik's Photo Machallovnik 19 Oct 2015

Posted Image
Quote

Machallovnik's Photo Machallovnik 20 Oct 2015

Thanks you all for advice but I solve it.I try change function to getEnergyProducedLastTick and that worked
Quote

TYKUHN2's Photo TYKUHN2 20 Oct 2015

Likely means HotFluid didn't exist for your version.
Quote