[Lua] Hello World - o3de/o3de GitHub Wiki
Simple Print
As per tradition, here is a simple Lua component that prints "Hello, world!" to the console when it activates.
local HelloWorld = {}
function HelloWorld:OnActivate()
Debug.Log("Hello, world!")
end
function HelloWorld:OnDeactivate()
end
return HelloWorld
Color Print
A neat tip you can use with Debug.Log
is you can prepend "$[0-9]"
to print to the console in various colors.
local HelloWorld = {}
function HelloWorld:OnActivate()
for i = 0, 9 do
Debug.Log("$" .. i .. "Hello, world! " .. i)
end
end
function HelloWorld:OnDeactivate()
end
return HelloWorld