Page 1 of 1

if statement syntax

Posted: Sun Feb 26, 2017 7:10 pm
by Bizobinator
I'm adding some recipes into a mod of mine that are dependent on stuff in another persons' mod(s). I'm getting an error though on my if statements that check before adding a recipe

Code: Select all

if data.raw.fluid["lithia-water"] then
	
		{
			type = recipe,
			name = "void-lithia-water",
			category = "void-liquid",
		  (etc, etc)	
end
Is there something wrong with my syntax? Does the if statement have to be outside of the

Code: Select all

data:extend
?

Re: if statement syntax

Posted: Sun Feb 26, 2017 7:33 pm
by prg
Bizobinator wrote:Is there something wrong with my syntax? Does the if statement have to be outside of the

Code: Select all

data:extend
?
Yes.

Re: if statement syntax

Posted: Sun Feb 26, 2017 11:59 pm
by Bizobinator
prg wrote:
Bizobinator wrote:Is there something wrong with my syntax? Does the if statement have to be outside of the

Code: Select all

data:extend
?
Yes.
Rats :P

Re: if statement syntax

Posted: Mon Feb 27, 2017 12:24 am
by Nexela
Rats how?

Code: Select all

if data.raw.fluid["lithia-water"] then
   
data:extend{
    {
         type = recipe,
         name = "void-lithia-water",
         category = "void-liquid",
        (etc, etc) 
    }
}  
end