Page 1 of 1

error loading mod

Posted: Fri Mar 03, 2017 12:00 am
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.

Re: error loading mod

Posted: Fri Mar 03, 2017 12:22 am
by DaveMcW
If you use a function to create the recipe table, you probably forgot to call it with parentheses.

Re: error loading mod

Posted: Fri Mar 03, 2017 12:23 am
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()
  }
{

Re: error loading mod

Posted: Sat Mar 04, 2017 12:28 am
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

Re: error loading mod

Posted: Sat Mar 04, 2017 12:37 am
by DaveMcW

Code: Select all

type = "recipe"

Re: error loading mod

Posted: Sat Mar 04, 2017 4:18 pm
by Bizobinator
I am dishonored.


Much dishonorbu.