Jump to content
g1doz

how to set multi function in one function

Recommended Posts

how to set multi function in one function

example

function fly_hack()
menu = gg.choice{"fly 1","fly 2","fly 3")","Back")
if not menu then home() end
if menu==1 then fly_1() end
if menu==2 then fly_2() end
if menu==3 then fly_3() end
if menu==6 then home() end
end

function fly_1()

end

function fly_2()

end

function fly_3()

end

i want to set this all function fly_hack and fly 1 2 3 in  one function how ?

Share this post


Link to post
Share on other sites

Functions are objects of the first class. Learn lua. You cannot “set” functions. This is nonsense.
Before calling a function, you must declare / create it.

Share this post


Link to post
Share on other sites

ok thanks you

Share this post


Link to post
Share on other sites
function fly_hack()
  table_menu = {"fly 1","fly 2","fly 3"}
  local menu = gg.choice(table_menu, 0,"Back")
  if not menu then home() end
  if menu==1 then fly_1() end
  if menu==2 then fly_2() end
  if menu==3 then fly_3() end
  if menu==6 then home() end
end

function fly_1()
  gg.alert(table_menu[1], "")
end

function fly_2()
  gg.alert(table_menu[2], "")
end

function fly_3()
  gg.alert(table_menu[3], "")
end

 

Share this post


Link to post
Share on other sites
Posted (edited)

function fly_hack()
local m = gg.choice{"fly 1","fly 2","fly 3","fly all"),nil,"Fly hack method")
if m==1 then fly_1() end
if m==2 then fly_2() end
if m==3 then fly_3() end

if m==4 then fly_1() fly_2() fly_3() end
if m==nil then home() end
end

function fly_1()

end

function fly_2()

end

function fly_3()

end

Edited by Rs92ks
Opt

Share this post


Link to post
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...