Jump to content

function


golanu21

Recommended Posts

Posted

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?

Posted
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 

Posted
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 ?

Posted

Maybe something like this:

  
function Gui() 
    guiSetVisible(guiwindow, false) 
    bindKey("F2","down", 
    function () 
    guiSetVisibile(guiwindow, true) 
    end) 
end 
  

Posted

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 

Posted
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?

Posted
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

Posted

You aren't passing any other argument to the function, but you're trying to concatenate a list of variables (which don't exist).

Delete line 2 and ", ..." from the parameters list of the function.

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...