Vec4ExampleCode: Difference between revisions
From Crumbled World Wiki
(Created page with "==Example Code== <syntaxhighlight lang="lua"> local a = Vec4(6, 8, 0, 0) local b = a + Vec4(-2,-2, 1, 0) * 2 print(b.x..", "..b.y..", "..b.z..", "..b.w) --print 2.0, 4.0, 2.0, 0.0 a:normalize() print(a.x..", "..a.y..", "..a.z..", "..b.w) --print 0.6, 0.8, 0.0, 0.0 </syntaxhighlight>") |
(No difference)
|
Latest revision as of 07:55, 6 July 2025
Example Code
local a = Vec4(6, 8, 0, 0)
local b = a + Vec4(-2,-2, 1, 0) * 2
print(b.x..", "..b.y..", "..b.z..", "..b.w) --print 2.0, 4.0, 2.0, 0.0
a:normalize()
print(a.x..", "..a.y..", "..a.z..", "..b.w) --print 0.6, 0.8, 0.0, 0.0