From 9c4600377ab60a81bc095b73ebf346703569ca53 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 15 Sep 2017 19:16:07 +0100 Subject: [PATCH] Trying to fix tostring --- locale/ExpGaming-Core/Core Help File.md | 2 +- locale/ExpGaming-Core/ExpGaming - Command Maker.lua | 8 ++++---- locale/ExpGaming-Core/ExpGaming - Lib.lua | 4 ++-- locale/ExpGaming-Core/ExpGaming - Server Interface.lua | 4 ++-- locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/ExpGaming-Core/Core Help File.md b/locale/ExpGaming-Core/Core Help File.md index db4aab1b..68a43fd3 100644 --- a/locale/ExpGaming-Core/Core Help File.md +++ b/locale/ExpGaming-Core/Core Help File.md @@ -65,7 +65,7 @@ See code for more details. * Convert ticks to hours based on game speed * tick_to_min (tick) * Convert ticks to minutes based on game speed -* table.to_string(tbl) +* table.tostring(tbl) * We stole this but we don't know from where, just google it * output -> table as a string ## Get Commands diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index 3d52eb57..02faf6cb 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -68,23 +68,23 @@ function load_command(command) local player = game.players[event.player_index] if not rank_allowed(get_rank(player),command.name) then player.print('401 - Unauthorized: Access is denied due to invalid credentials') - game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Unauthorized): '..command.name..' With args of: '..table.to_string(get_command_args(event,command,true)), true, 0) + game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Unauthorized): '..command.name..' With args of: '..table.tostring(get_command_args(event,command,true)), true, 0) return end local args = get_command_args(event,command) if args == 'Invalid' then player.print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return - game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Invalid Args): '..command.name..' With args of: '..table.to_string(get_command_args(event,command,true)), true, 0) + game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Invalid Args): '..command.name..' With args of: '..table.tostring(get_command_args(event,command,true)), true, 0) end command.event(player,event,args) player.print('Command Complete') - game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Used command: '..command.name..' With args of: '..table.to_string(args), true, 0) + game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) else local args = get_command_args(event,command) if args == 'Invalid' then print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return end command.event('',event,args) print('Command Complete') - game.write_file('commands.log','\n'..game.tick..' Player: Used command: '..command.name..' With args of: '..table.to_string(args), true, 0) + game.write_file('commands.log','\n'..game.tick..' Player: Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) end end) end diff --git a/locale/ExpGaming-Core/ExpGaming - Lib.lua b/locale/ExpGaming-Core/ExpGaming - Lib.lua index ef689962..f1092b3a 100644 --- a/locale/ExpGaming-Core/ExpGaming - Lib.lua +++ b/locale/ExpGaming-Core/ExpGaming - Lib.lua @@ -43,7 +43,7 @@ function table.val_to_str ( v ) end return '"' .. string.gsub(v,'"', '\\"' ) .. '"' else - return "table" == type( v ) and table.to_string( v ) or + return "table" == type( v ) and table.tostring( v ) or tostring( v ) end end @@ -56,7 +56,7 @@ function table.key_to_str ( k ) end end -function table.to_string( tbl ) +function table.tostring( tbl ) local result, done = {}, {} for k, v in ipairs( tbl ) do table.insert( result, table.val_to_str( v ) ) diff --git a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua index 4df3d8f5..802f2035 100644 --- a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua +++ b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua @@ -22,11 +22,11 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits define_command('server-interface','For use of the highest staff only',{'command',true},function(player,event,args) if player == '' then local returned,value = pcall(loadstring(event.parameter)) - if type(value) == 'table' then game.write_file('server-interface.log', '\n'..game.tick..' Ran by: Code: '..event.parameter..'\n Returned: '..table.to_string(value), true, 0) print(table.to_string(value)) + if type(value) == 'table' then game.write_file('server-interface.log', '\n'..game.tick..' Ran by: Code: '..event.parameter..'\n Returned: '..table.tostring(value), true, 0) print(table.tostring(value)) else game.write_file('server-interface.log', '\n'..game.tick..' Ran by: Code: '..event.parameter..'\nReturned: '..tostring(value), true, 0) print(value) end else local returned,value = pcall(loadstring(event.parameter)) - if type(value) == 'table' then game.write_file('server-interface-players.log', '\n'..game.tick..' Ran by: '..player.name..' Code: '..event.parameter..'\n Returned: '..table.to_string(value), true, 0) player.print(table.to_string(value)) + if type(value) == 'table' then game.write_file('server-interface-players.log', '\n'..game.tick..' Ran by: '..player.name..' Code: '..event.parameter..'\n Returned: '..table.tostring(value), true, 0) player.print(table.tostring(value)) else game.write_file('server-interface-players.log', '\n'..game.tick..' Ran by: '..player.name..' Code: '..event.parameter..'\nReturned: '..tostring(value), true, 0) player.print(value) end end end) diff --git a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua index e991782e..6dd67cd4 100644 --- a/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua +++ b/locale/ExpGaming-Core/GUI/ExpGaming - Popup.lua @@ -62,7 +62,7 @@ function draw_frame.popup(style,args) local args = args or {} local frame_data = nil for _,frame in pairs(frames.popup) do if style == frame.style then frame_data = frame break end end - game.write_file('popups.log','\n'..game.tick..' Popup Style: '..style..' Was made with args of: '..table.to_string(args), true, 0) + game.write_file('popups.log','\n'..game.tick..' Popup Style: '..style..' Was made with args of: '..table.tostring(args), true, 0) for _,player in pairs(game.connected_players) do local popups = mod_gui.get_frame_flow(player).popups local frame = get_next_popup(popups)