mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
[added] tostring for vec2 and vec3 - not sure how to handle wanting more/less precision for these currently.
This commit is contained in:
parent
c191a7b4f6
commit
afd279f1db
5
vec2.lua
5
vec2.lua
@ -9,6 +9,11 @@ local math = require(path .. "mathx") --shadow global math module
|
||||
local vec2 = class()
|
||||
vec2.type = "vec2"
|
||||
|
||||
--stringification
|
||||
vec2.__mt.__tostring = function(self)
|
||||
return ("(%.2f, %.2f)"):format(self.x, self.y)
|
||||
end
|
||||
|
||||
--probably-too-flexible ctor
|
||||
function vec2:new(x, y)
|
||||
if x and y then
|
||||
|
5
vec3.lua
5
vec3.lua
@ -11,6 +11,11 @@ local math = require(path .. "mathx") --shadow global math module
|
||||
local vec3 = class()
|
||||
vec3.type = "vec3"
|
||||
|
||||
--stringification
|
||||
vec2.__mt.__tostring = function(self)
|
||||
return ("(%.2f, %.2f, %.2f)"):format(self.x, self.y, self.z)
|
||||
end
|
||||
|
||||
--probably-too-flexible ctor
|
||||
function vec3:new(x, y, z)
|
||||
if x and y and z then
|
||||
|
Loading…
Reference in New Issue
Block a user