Page 1 of 1

[15.37] Crash on: "PrototypeLoader::loadPrototypes"

Posted: Sun Nov 05, 2017 3:38 pm
by TheSeriusYoutuber
Now this is complicated. My mod(RobotDeployer) seems to cause a factorio crash.I dont know how to fix it.Seems like something to do with visual studio.
https://www.dropbox.com/s/smyx5te96f7ph37/mods.zip?dl=0

Re: [15.37] Crash on: "PrototypeLoader::loadPrototypes"

Posted: Sun Nov 05, 2017 4:20 pm
by Rseding91
Thanks for the report. The crash is fixed in 0.16 already. What's wrong is a few things:
  • You've included your settings in the data stage - they don't go there. Just delete "require("settings")" from data.lua
  • Your "settingspanel.lua" file is completely broken (see blow)
This - is unreadable

Code: Select all

function GetSettingsValue(SettingsValue)
if (SettingsValue.value==nil) then local output=false else local output=true end
if (output==true) then local returnstring=settings.startup[SettingsValue].value end
return returnstring
end
You're using locals inside if/else statements which means they only exist for those branches. As soon as the if/else is left that value is now nil - gone. Because of that every call to that function will always return nil - which isn't valid for anything asking for a setting. You should use this:

Code: Select all

function GetSettingsValue(setting, defaultValue)
	if (settings.startup[setting] == nil) then
		return defaultValue;
	end
	
	return settings.startup[setting].value
end
Here it takes a setting name to look up and a default value if that setting doesn't exist. If it doesn't exist it returns the default value and it's all good.

Re: [15.37] Crash on: "PrototypeLoader::loadPrototypes"

Posted: Mon Nov 06, 2017 6:10 am
by TheSeriusYoutuber
Thank you so much, you can lock this now! :D

Re: [15.37] Crash on: "PrototypeLoader::loadPrototypes"

Posted: Mon Nov 06, 2017 6:10 am
by TheSeriusYoutuber
Thank you so much, you can lock this now! :D