KirkMcDonald / factorio-tools

Tools dealing with the game Factorio.
50 stars 28 forks source link

Error: attempt to index a nil value using factoriocalc #7

Open seonwoolee opened 5 years ago

seonwoolee commented 5 years ago

Your calculator is amazing for vanilla, so thank you.

I'm interested in running factoriocalc locally so I can have it calculate the rates for recipes in some of the mods I use.

I'm running Factorio 0.17 on Linux, using the standalone installation. I have Factorio installed at /run/media/seonwoo/Steam/Factorio-Linux (despite the path, I don't actually have Factorio installed through Steam on Linux) and I have my mods directory at /mnt/veracrypt2/Factorio/mods. When I run

go run main.go -gamedir /run/media/seonwoo/Steam/Factorio-Linux/ -moddir /mnt/veracrypt2/Factorio/mods/ -verbose

I get the nil value attempted error.

I've narrowed it down to this line: https://github.com/KirkMcDonald/factorio-tools/blob/a22a0b3c49ad14c441004043876a932e83941b0a/factorioload/load.go#L228

I've never used Lua so I have no idea what L.Call is meant to do.

Does this have anything to do with the fact that FactorioLoaderLib doesn't work with packed mods? What exactly do you mean by "packed" mods - mods that have been compiled and don't provide source code? (I should preface this with I have no experience with creating mods in Factorio).

KirkMcDonald commented 5 years ago

Don't trust the FactorioLoaderLib readme. That's an artifact from wherever I originally forked it from, and I've modified the library significantly since then. I believe that "packed" mods refers to mods which have been packaged into a .zip file, which it does support. (Adding this support is one of the major things I have done to the library.)

L.Call calls a Lua function. In this case, it is calling FactorioLoaderLib's load_data function, which is its main entry point. So the error message you're seeing is incredibly unspecific, no more than just saying, "Something went wrong." (See also #3.)

However, I haven't properly updated factoriocalc since the 0.17 release, and I suspect this error is related to that. It should be a simple matter of updating the repo's submodules and putting out a new binary release. I'll get to it later.

philomelus commented 5 years ago

Anxiously awaiting new binary. Thanks for this!

KirkMcDonald commented 5 years ago

Okay, I have uploaded release 0.3. It appears to work for my installation.

RustyBlade64 commented 5 years ago

I have fixed one potential case for this error in KirkMcDonald/FactorioLoaderLib#7, but without reporduction steps it is impossible to say whether it is your case or not.

@seonwoolee can you please post the mod-list.json and (if it exists) mod-settings.dat that produce the error in question?

veastark commented 4 years ago

Hey, I just downloaded 0.3 and ran into the same issue.

mod-list.json and mod-settings.dat are attached. They are a bit of a wild mix so maybe that's the cause. mods.zip