“Lua Global” Code-Antworten

Lua Global

-- Pure Lua:
hello = 2

-- Roblox Lua:
hello = 2
_G.hello = 2
getgenv().hello = 2
Breakable Buzzard

Lua Global

--Getfenv used the make normal variables into a global variable

myVariable = "Hello, environments" -- Note: a global variable (non-local)
local env = getfenv()
print(env["myVariable"]) --> Hello, environments
Hypixel Offical

Globale Variablen Lua

--[[
Global variables don't need a declaration like "local." Instead, you'd just
write like this:
]]--

variable = --value

--[[ 
Note, you don't always have to even assign a value to a variable. You can
use it for the first time and get a value of "nil" which you can update later.
]]--
Concerned Civet

Ähnliche Antworten wie “Lua Global”

Fragen ähnlich wie “Lua Global”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen