error loading mod

Place to get help with not working mods / modding interface.
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

error loading mod

Post by Bizobinator »

Hey all, I've been working on a mod of mine, & I'm still trying to get the game to load with it enabled.

I got through a number of 'standard' syntax errors, but then got this one:

Code: Select all

Error while trying to copy to data.raw: Can't copy object of type function
Unfortunately, it didn't give a file name or location :/.

Any idea what is causing this? The only place I reference data.raw is in one of the recipe files, where I check "If data.raw.fluid["blah blah"] then create recipe" for a number of fluids. But, the syntax stuff all seemed to run fine through all the recipes that I listed.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3752
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: error loading mod

Post by DaveMcW »

If you use a function to create the recipe table, you probably forgot to call it with parentheses.
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: error loading mod

Post by Nexela »

Without you posting the source I can only speculate that you are doing something like this.

Code: Select all

function function_name()
---
end

data:extend{
  {
    type = blah,
    name = function_name  -- This will put the function not the return here....  you would have to do name = function_name()
  }
{
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: error loading mod

Post by Bizobinator »

Oki-dokes, I've isolated things a little bit more.

I commented out all the if-then-end statements, & it loaded fine.

I then uncommented the first, and it gave the error.

So..., here's that bit of code:

Code: Select all

if data.raw.fluid["lithia-water"] then
data:extend(
{

	{
		type = recipe,
		name = "void-lithia-water",
		category = "void-liquid",
		hidden = "true",
		energy_required = 0.5,
		ingredients = 
		{
			{type = "fluid", name = "lithia-water", amount = 1}
		},
		results = 
		{
			{type = "item", name = "void", amount = 1, probability = 0}
		},
		subgroup = "void",
		icon = "__bobplates__/graphics/icons/lithia-water.png",
		order = "lithia-water"
	},

}
)
end

(Yes, I have already checked with Bobingabout about using this graphics)

Thanks for your help m8s
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3752
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: error loading mod

Post by DaveMcW »

Code: Select all

type = "recipe"
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: error loading mod

Post by Bizobinator »

I am dishonored.


Much dishonorbu.
Post Reply

Return to “Modding help”