diff --git a/ExpCore/gui.lua b/ExpCore/gui.lua index 37d40276..e6f98b9d 100644 --- a/ExpCore/gui.lua +++ b/ExpCore/gui.lua @@ -49,6 +49,21 @@ function Gui.bar(frame,width) return line end +--- Used to set the index of a drop down to a certian item +-- @usage Gui.set_dropdown_index(dropdown,player.name) +-- @param dropdown the dropdown that is to be effected +-- @param _item this is the item to look for +-- @return returns the dropdown if it was successful +function Gui.set_dropdown_index(dropdown,_item) + if dropdown and dropdown.valid and dropdown.items and _item then else return end + local _index = 1 + for index, item in pairs(dropdown.items) do + if item == _item then _index = index break end + end + dropdown.selected_index = _index + return dropdown +end + local function _thread() local thread = Server.get_thread('camera-follow') if not thread then diff --git a/ExpLib.lua b/ExpLib.lua index 9a502247..b3f8c49f 100644 --- a/ExpLib.lua +++ b/ExpLib.lua @@ -63,7 +63,7 @@ function ExpLib.player_return(rtn,colour,player) end --- Logs an embed to the json.data we use a js script to add things we cant here --- @usage json_emit{title='BAN',color_name='info',description='A player was banned' ... } +-- @usage json_emit{title='BAN',color='0x0',description='A player was banned' ... } -- @tparam table arg a table which contains everything that the embeded will use -- @param[opt=''] title the tile of the embed -- @param[opt='0x0'] color the color given in hex you can use Color.to_hex{r=0,g=0,b=0} diff --git a/control.lua b/control.lua index 6cbaf9df..bfa67c15 100644 --- a/control.lua +++ b/control.lua @@ -13,7 +13,7 @@ _error = error error = function(err) if _G.discord_emit and game then local color = _G.Color and Color.to_hex(defines.text_color.bg) or '0x0' - discord_emit{title='SCRIPT ERROR',color=color,description=err} + discord_emit{title='SCRIPT ERROR',color=color,description='There was an error in the script @Developers ',Error=err} elseif _G.Game and game then if Game.print_all(err) == 0 then _error(err)