[Help] functions

Alright so I’ll try and make this as simple as possible to explain.

I’m currently messing around with the Action Menu, and before you direct me to that thread hear me out. I’m extremely new to LUA so bare with me.

I’m currently just trying to understand how to call functions from other scripts and I actually now understand how that works.
For example: handsUp() to call function handsUp()

What I don’t know how to do is call a “Citizen.CreateThread(function()”. What made it easy for me to understand how to call normal functions is they usually have a name to it, so you can call it in the script. On the other hand I see in most scripts “Citizen.CreateThread” has no name. Is that because its not being called, instead just being ran as the script passes by it?

Sorry if this doesn’t make sense, just trying to learn. :slight_smile:

Essentially Citizen.CreateThread is always running: Here are a few examples.

Citizen.CreateThread(function()
        while true do -- this will always be checked, no need to call Citizen.CreateThread
               Citizen.Wait(0) -- always have to do this to avoid crashing
               if localVariable then -- if localVarible is true then
                      --do something
               end
               if not otherLocalVariable then
                      --do something
               end
        end
end)

Gotcha, thank you for the response.