Page 1 of 1

[0.9.0] Not sure if it is a bug (Control.lua, getliquid())

Posted: Wed Feb 26, 2014 5:55 pm
by ficolas
I tried to get liquid from a entity in the control.lua, but it doesnt seem to work (returns nil), the entitt is a storage tank, I tried to do it in the console, and it works.
Im sure the entity is a storage tank, because I printed the name.

Edit: Not sure if this matters but it is in the onguiclick event.

Re: [0.9.0] Not sure if it is a bug (Control.lua, getliquid(

Posted: Fri Feb 28, 2014 7:08 pm
by kovarex
I tried it in the console as well and it works, I don't know why it couldn't work, are you sure it is not some other error?
Can you minimise the error to smallest possible code example ?

Re: [0.9.0] Not sure if it is a bug (Control.lua, getliquid(

Posted: Fri Feb 28, 2014 11:12 pm
by immibis
What happens if you connect pipes to all possible connection spots?

getliquid returns the contents of one "fluid container" and you can't specify which one, so it might be getting the fluid in one of the pipe connections.

Re: [0.9.0] Not sure if it is a bug (Control.lua, getliquid(

Posted: Sat Mar 01, 2014 7:49 am
by kovarex
immibis wrote:What happens if you connect pipes to all possible connection spots?

getliquid returns the contents of one "fluid container" and you can't specify which one, so it might be getting the fluid in one of the pipe connections.
The pipe has just one fluidbox, so this method will work fine for it. The count of connections of the fluidbox doesn't really matter.

Re: [0.9.0] Not sure if it is a bug (Control.lua, getliquid(

Posted: Fri Mar 07, 2014 9:49 am
by ficolas
Ok sorry for tanking so long answering this.
Is not a bug, it only happens when the storage of the tank is empty, that confused me a bit.

Re: [0.9.0] Not sure if it is a bug (Control.lua, getliquid(

Posted: Fri Mar 07, 2014 11:20 pm
by immibis
ficolas wrote:Ok sorry for tanking so long answering this.
Is not a bug, it only happens when the storage of the tank is empty, that confused me a bit.
Okay, that makes sense. When the tank is empty, there's no liquid in it. getliquid() returns nil to mean "no liquid" - otherwise it would have to specify a type.