Help with this function

Hey guys so i was just reading up on the gmod wiki for lua scripting tutorials and i came across a simple function like this

function myFunc() 
    Msg("I ran myFunc
function whoRanMyFunc(who) 
    Msg(who.." ran myFunc

And then right after that i came across this

function myFunc(input)
    local output
    --do stuff to input within your function--
    return output --returns what you want it to back into the main program for usage
--OR, you don't even declare a local variable within the function and just put "return <whatever you want done to input to be returned>

now i was wondering what exactly local output actually does, i know this is probably one of the dumbest posts ever but yeah i just don’t really get it too much so if someone could make it a little more clear for me that’d be nice.

The local makes the variable only to be used inside the function. You can also use local in a file to make it only accessible in that file.
a = 1

function myfunc()
local a = 2
return a

– 1

– 2[/lua]

okay thanks alot man :slight_smile:

[editline]11th November 2014[/editline]

LOL i totally get it now, i’m a total idiot lol thanks for the help man :slight_smile: