Jump to content

Mod compatibility crash, string.upper = nil


Recommended Posts

The Gollum character mod crashes when my Wog'Maw mod loads in the character to the server. The error is bad argument #1 to 'upper' (string expected, got nil). The line it's crashing on is: 

local character = type(inst) == "string" and string.upper(inst) or (inst ~= nil and string.upper(inst.prefab))

Now, rather than contacting the other mod's author to make an error handler, is there something I should change with my mod? Is it because my character's name has an apostrophe in it? Is there a field I've left blank somehow? 

 

 

Here's the full function that's erroring out:

if not _G.mods.GetStringOverwrite then	_G.mods.GetStringOverwrite = true	local old_GetString = _G.GetString	_G.GetString = function(inst, stringtype, modifier,...)		local character = type(inst) == "string" and string.upper(inst) or (inst ~= nil and string.upper(inst.prefab))		if character and stringtype and type(modifier) == "table" and _G.STRINGS.CHARACTERS[character] then			stringtype = string.upper(stringtype)			local topic_tab = _G.STRINGS.CHARACTERS[character][stringtype]			if topic_tab and type(topic_tab)=="table" then				local ret = topic_tab				for i,v in ipairs(modifier) do					if type(ret)~="table" then						return --No crash					end					ret = ret[v]				end			end		end		return old_GetString(inst, stringtype, modifier,...)	endend
Link to comment
Share on other sites

@StarmanUltra, well, kind of.

You can fix it by your side.

 

Replace

	inst.components.hunger:SetPercent(0.2)	inst.components.talker:Say("Want food!")

near line 224 in your master_postinit for

	inst:DoTaskInTime(0.2, function()		inst.components.hunger:SetPercent(0.2)		inst.components.talker:Say("Want food!")	end)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...