Jump to content

function


golanu21

Recommended Posts

how i can make function in another function ?

for example

function gui () -- this is a function 
         --there is a gui 
          guiSetVisibile(guiwindow, false) 
         --and here i want to start other function with bindKey 

or, how i make

setElementData 

for a gui?

Link to comment
function Gui() -- this is a function 
    --there is a gui 
    guiSetVisible(guiwindow, false) 
    --and here i want to start other function with bindKey 
    bindKey("yourkey", keystate, functionname) 
    --keystate = "up" or "down" 
end 

Link to comment
function Gui() -- this is a function 
    --there is a gui 
    guiSetVisible(guiwindow, false) 
    --and here i want to start other function with bindKey 
    bindKey("yourkey", keystate, functionname) 
    --keystate = "up" or "down" 
end 

for example

function Gui() -- this is a function 
    --there is a gui 
    guiSetVisible(guiwindow, false) 
    --and here i want to start other function with bindKey 
    bindKey("F2","down", showgui) 
    function showgui () 
    guiSetVisibile(guiwindow, true) 
    end 
end 

i can make that ?

Link to comment

Why do you want to create a function in another function, create it outside of it so you can call it back alot more. Thats called OOP (Object Orientated Programming).

function Gui() 
    guiSetVisible(guiwindow, false); 
    bindKey("F2","down", showgui); 
    showGui("guiwindow"); 
end 
  
function showGui (window) 
    guiSetVisibile(window, true) 
end 

Link to comment
Why do you want to create a function in another function, create it outside of it so you can call it back alot more. Thats called OOP (Object Orientated Programming).
function Gui() 
    guiSetVisible(guiwindow, false); 
    bindKey("F2","down", showgui); 
    showGui("guiwindow"); 
end 
  
function showGui (window) 
    guiSetVisibile(window, true) 
end 

Is it?

Link to comment
function createcomand(cmd, gangname, ...) 
    local gangname = table.concat({...}, " ") 
    if gangname then 
        guiSetVisible(factionwindow, true) 
        guiSetText(factionwindow, "Faction-System|By: 'golanu21',"..gangname..".") 
    else 
        outputChatBox("[invalid Syntax]: /createfaction NAME", source, 255, 0, 0) 
    end 
end 
addCommandHandler("makefaction", createcomand) 

the gangname is global, wtf ???, this is the eror

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...