Fixed Sytax

This commit is contained in:
Cooldude2606
2017-08-20 20:39:17 +01:00
parent 3a5c73f0a0
commit 324ba6ef7a
7 changed files with 12 additions and 12 deletions

View File

@@ -50,7 +50,7 @@ function define_command(name,help,inputs,restriction,event)
local inputs = inputs or {true}
local restriction = restriction or 0
if not event or type(event) ~= 'function' then error('Command requires a function') end
table.insert(Exp_commands,{name,help,inputs,restriction,event})
table.insert(Exp_commands,{name=name,help=help,inputs=inputs,restriction=restriction,event=event})
end
--The magic for the commands. It is a hard bit of code so GL; but it will call the command event have some sanitisaion of the input
function load_command(command)

View File

@@ -125,7 +125,7 @@ function get_ranked_players(rank)
local to_return = {}
for _,player in paris(game.players) do
if not rank or rank == get_rank(player).name then
table.insert(to_return,{player.name,tick_to_display_format(player.online_time),get_rank(player).name}) set_ending_screen_data
table.insert(to_return,{player.name,tick_to_display_format(player.online_time),get_rank(player).name})
end
end
return to_return

View File

@@ -27,14 +27,14 @@ local draw_frame = ExpGui.draw_frame
function add_frame.center(name,default_display,default_tooltip,restriction,tabs,event)
if not name then error('Frame requires a name') end
local tabs = tabs or {}
table.insert(frames.center,{name,default_display,tabs,event})
table.insert(frames.center,{name=name,display=default_display,tabs=tabs,event=event})
ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.center)
end
--Define a tab; frame is needed as every tab must be used once; event(player,tab) is the draw function
function add_frame.tab(name,default_display,default_tooltip,restriction,frame,event)
if not name then error('Tab requires a name') end
if not frame then error('Tab requires a frame') end
table.insert(frames.tabs,{name,default_display,frame,event})
table.insert(frames.tabs,{name=name,display=default_display,frame=frame,event=event})
for _,f in pairs(frames.center) do if f.name == frame then table.insert(f.tabs,{name,restriction}) end end
ExpGui.add_input.button(name,default_display,default_tooltip,draw_frame.tab)
end
@@ -56,7 +56,7 @@ function draw_frame.center(player,element)
local restriction = temp_restriction or string_to_rank(t.restriction).power or 0
if restriction >= get_rank(player).power then ExpGui.add_input.draw_button(tab_bar,t.name) end
end
draw_frame.tab(player,tab_bar[frame_data.tabs[1].name)
draw_frame.tab(player,tab_bar[frame_data.tabs[1]].name)
ExpGui.add_input.draw_button(tab_bar,'close_center')
tab.style.minimal_height = 300
tab.style.maximal_height = 300

View File

@@ -23,12 +23,12 @@ local inputs = ExpGui.inputs
--allows defining of new buttons;;name how to call button;;default_display what is shown on the button;;default_tooltip the tooltip display;;event function(player,element) that runs on click
function add_input.button(name,default_display,default_tooltip,event)
if not name then error('Button requires a name') end
table.insert(inputs.buttons,{name,default_display,default_tooltip,event})
table.insert(inputs.buttons,{name=name,display=default_display,tooltip=default_tooltip,event=event})
end
--allows defining of text box inputs;;name how to call button;;default_display what is shown on the button;;event function(player,element) that runs on text change
function add_input.text(name,default_display,event)
if not name then error('Text Filed requires a name') end
table.insert(inputs.text,{name,default_display,event})
table.insert(inputs.text,{name=name,display=default_display,event=event})
end
--draws the button into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overrides the default;;tooltip(opptinal) overrides the default
function add_input.draw_button(frame,name,display,tooltip)

View File

@@ -28,7 +28,7 @@ function add_frame.left(name,default_display,default_tooltip,restriction,vis,eve
if not name then error('Frame requires a name') end
if not event or type(event) ~= 'function' then error('Frame requires a draw function') end
local vis = vis or false
table.insert(frames.left,{name,default_display,event,vis})
table.insert(frames.left,{name=name,display=default_display,event=event,vis=vis})
ExpGui.toolbar.add_button(name,default_display,default_tooltip,restriction,draw_frame.left)
end
--draw the left GUI for the player; called via script, only call manually when update is true and element is the name of the GUI

View File

@@ -45,7 +45,7 @@ function add_frame.popup(style,default_display,default_tooltip,restriction,on_cl
if not style then error('Popup style requires a name') end
if not event or type(event) ~= 'function' then error('Popup style requires a draw function') end
local restriction = restriction or 0
table.insert(frames.popup,{style,default_display,on_click,event})
table.insert(frames.popup,{style=style,display=default_display,on_click=on_click,event=event})
if on_click and type(on_click) == 'function' then
ExpGui.toolbar.add_button(style,default_display,default_tooltip,restriction,draw_frame.popup_button)
end
@@ -53,7 +53,7 @@ end
--draw the popup on_click GUI for the player; do not call manually must use other functions to call
function draw_frame.popup_button(player,element)
local frame_data = nil
for _,frame in pairs(frames.popup) do if element.name == frame[1] then frame_data = frame break end end
for _,frame in pairs(frames.popup) do if element.name == frame.style then frame_data = frame break end end
local popups = mod_gui.get_frame_flow(player).popups
if popups[frame_data.name..'_on_click'] then popups[frame_data.name..'_on_click'].destroy() return end
local frame = get_next_popup(popups,frame_data.name)
@@ -63,7 +63,7 @@ end
function draw_frame.popup(style,args)
local args = args or {}
local frame_data = nil
for _,frame in pairs(frames.popup) do if style == frame[1] then frame_data = frame break end end
for _,frame in pairs(frames.popup) do if style == frame.style then frame_data = frame break end end
for _,player in pairs(game.connected_players) do
local popups = mod_gui.get_frame_flow(player).popups
local frame = get_next_popup(popups)

View File

@@ -23,7 +23,7 @@ local toolbar = ExpGui.toolbar
function toolbar.add_button(name,default_display,default_tooltip,restriction,event)
local restriction = restriction or 0
if not name then error('Button requires a name') end
table.insert(toolbar.buttons,{name,restriction})
table.insert(toolbar.buttons,{name=name,restriction=restriction})
ExpGui.add_input.button(name,default_display,default_tooltip,event)
end
--draw the toolbar to the player only showing buttons within their restriction