StarmanUltra Posted August 26, 2015 Share Posted August 26, 2015 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 More sharing options...
DarkXero Posted August 26, 2015 Share Posted August 26, 2015 @StarmanUltra, well, somehow the inst.prefab can be nil sometimes. So you should do like the old GetString does.local character = (type(inst) == "string" and string.upper(inst)) or (inst ~= nil and inst.prefab and string.upper(inst.prefab)) or nil Link to comment Share on other sites More sharing options...
StarmanUltra Posted August 26, 2015 Author Share Posted August 26, 2015 @DarkXero So the problem is squarely on the Gollum mod's lack of an error handler, and there's nothing wrong with mine? Link to comment Share on other sites More sharing options...
DarkXero Posted August 26, 2015 Share Posted August 26, 2015 @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 More sharing options...
StarmanUltra Posted August 26, 2015 Author Share Posted August 26, 2015 Ah! Thank you I'd have never suspected that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now