Jump to content

LUA ERROR: bad argument to 'SetColour'"I fixed it with a neural network.


calkef
  • Closed

I play with a lot of mods.and some of them.He didn't let me log in to the server.I threw an error into the neural network on the 2nd attempt, it did everything.The error was related to the game itself, as error trecker did not specify the mod that made the mistake.

[00:18:59]: [string "scripts/widgets/text.lua"]:58: bad argument #3 to 'SetColour' (number expected, got no value)
LUA ERROR stack traceback:
    =[C]:-1 in (method) SetColour (C) <-1--1>
    scripts/widgets/text.lua:58 in (method) SetColour (Lua) <56-59>
    scripts/widgets/redux/lobbychatline.lua:182 in (field) _ctor (Lua) <119-194>
    scripts/class.lua:191 in (upvalue) LobbyChatLine (Lua) <181-194>
    scripts/widgets/redux/lobbychatqueue.lua:132 in (method) PushMessage (Lua) <108-174>
    scripts/widgets/redux/lobbychatqueue.lua:44 in (method) Rebuild (Lua) <34-47>
    scripts/widgets/redux/lobbychatqueue.lua:31 in (field) _ctor (Lua) <11-32>
    scripts/class.lua:191 in (upvalue) LobbyChatQueue (Lua) <181-194>
    scripts/widgets/redux/chatsidebar.lua:122 in (method) BuildChatWindow (Lua) <117-128>
    scripts/widgets/redux/chatsidebar.lua:31 in (method) BuildSidebar (Lua) <29-32>
    scripts/widgets/redux/chatsidebar.lua:22 in (field) _ctor (Lua) <15-27>
    scripts/class.lua:191 in (upvalue) ChatSidebar (Lua) <181-194>
    scripts/screens/redux/lobbyscreen.lua:591 in (field) _ctor (Lua) <511-669>
    scripts/class.lua:191 in (local) LobbyScreen (Lua) <181-194>
    scripts/mainfunctions.lua:2031 in () ? (Lua) <2025-2051>

 


Steps to Reproduce

Steam\steamapps\common\Don't Starve Together\data\databundles\scripts.zip\scripts\widgets\text

on line 58, the neural network replaced the function with this one

function Text:SetColour(r, g, b, a) if type(r) == "number" then -- Make sure all values default to something valid self.colour = { r or 1, g or 1, b or 1, a or 1 } else self.colour = r or { 1, 1, 1, 1 } end -- Ensure all values are numbers with defaults local cr = self.colour[1] or 1 local cg = self.colour[2] or 1 local cb = self.colour[3] or 1 local ca = self.colour[4] or 1 -- Now call with all parameters guaranteed to be numbers self.inst.TextWidget:SetColour(cr, cg, cb, ca) end

 

text.lua




User Feedback


This type of solution covers up a core issue elsewhere in this case the chathistory handler if one of your mods inserted a message without the colour parameter it should crash because this is not defined behaviour.

Changed Status to Closed

  • Thanks 2

Share this comment


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

×
  • Create New...