Skip to content

Commit

Permalink
Fixed: POA:Export does not use NULL
Browse files Browse the repository at this point in the history
Fixed: `POA:IsSame` inversed logic
Added: More conversion methods to POA
  • Loading branch information
dvdvideo1234 committed Apr 3, 2024
1 parent 3249a4e commit 4271fbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present
------------ CONFIGURE ASMLIB ------------

asmlib.InitBase("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","8.754")
asmlib.SetOpVar("TOOL_VERSION","8.755")

------------ CONFIGURE GLOBAL INIT OPVARS ------------

Expand Down
32 changes: 21 additions & 11 deletions lua/trackassembly/trackasmlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1552,37 +1552,47 @@ function NewPOA()
local self, mRaw = {0, 0, 0}
local mMis = GetOpVar("MISS_NOSQL")
local mSep = GetOpVar("OPSYM_SEPARATOR")
function self:Set(nA, nB, nC)
self[1] = (tonumber(nA) or 0)
self[2] = (tonumber(nB) or 0)
self[3] = (tonumber(nC) or 0)
return self
end
function self:Get()
return unpack(self)
end
function self:Table()
return {unpack(self)}
end
function self:Vector()
return Vector(unpack(self))
end
function self:Angle()
return Angle(unpack(self))
end
function self:String()
return tableConcat(self, mSep):gsub("%s","")
end
function self:Set(nA, nB, nC)
self[1] = (tonumber(nA) or 0)
self[2] = (tonumber(nB) or 0)
self[3] = (tonumber(nC) or 0)
return self
end
function self:Raw(sRaw)
if(IsHere(sRaw)) then
mRaw = tostring(sRaw or "") end
return mRaw -- Source data manager
end
function self:IsSame(tPOA)
for iD = 1, 3 do
if(tPOA[iD] ~= self[iD]) then return true end
end; return false
if(tPOA[iD] ~= self[iD]) then return false end
end; return true
end
function self:IsZero()
for iD = 1, 3 do
if(self[iD] ~= 0) then return false end
end; return true
end
function self:Export(sDes)
local sD, sR = tostring(sDes or mMis), self:Raw()
local sE = (self:IsZero() and sE or self:String())
return (sR and sR or sE)
local sS = self:String()
local sD = tostring(sDes or mMis)
local sE = (self:IsZero() and sD or sS)
return (mRaw and mRaw or sE)
end
function self:Decode(sStr)
local sStr = tostring(sStr or "") -- Default to string
Expand Down

0 comments on commit 4271fbe

Please sign in to comment.