“Lua Roblox Globale Variablen” Code-Antworten

Lua Roblox Globale Variablen

--Our variable is this
var="a"
--and we cant use it in a function it gives we an error
function abc()
	print(var)
end
abc()
--Output: Error
--We can make it a global variable with using _G. method
_G.var2="b"
function cba()
	print(_G.var2)
end
cba()
--Output: b
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 Roblox Globale Variablen”

Fragen ähnlich wie “Lua Roblox Globale Variablen”

Weitere verwandte Antworten zu “Lua Roblox Globale Variablen” auf Lua

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen