Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What are those fancy functions?

Asked by
cancle5 120
2 years ago

I have recently saw some fancy functions and want to try them out! I usually use those basic functions that everyone else uses. Could someone explain what everything does?

What I do

local function Hello(Message)
    print(Message)
end

What I see

function main:GetRandomSound(SoundTable : {}) : string
    return SoundTable[math.random(#SoundTable)]
end

1 answer

Log in to vote
0
Answered by 2 years ago

they are virtually the same, the second one just looks more complex because by the looks of it it is using returning and tables (which aren't complex)

local functions are local (meaning they use scope)

global functions (or functions without the local prefix DO NOT USE SCOPE)

for more information on scope see the link bellow:

https://developer.roblox.com/en-us/articles/Scope

0
sounds contradictory Xapelize 2658 — 2y
Ad

Answer this question