nil handling

This commit is contained in:
Chr1Z93 2024-11-19 20:57:28 +01:00
parent a13314f61c
commit 17bc2b1dc2

View File

@ -2905,15 +2905,19 @@ end
function updateTokenTransform(card)
for _, tokenData in ipairs(cardTokens[card] or {}) do
tokenData.token.setPosition(card.positionToWorld(tokenData.localPos))
tokenData.token.setRotation(card.getRotation() + tokenData.localRot)
tokenData.token.locked = true
if tokenData.token ~= nil then
tokenData.token.setPosition(card.positionToWorld(tokenData.localPos))
tokenData.token.setRotation(card.getRotation() + tokenData.localRot)
tokenData.token.locked = true
end
end
end
function stopTokenTransformUpdating(card)
for _, tokenData in ipairs(cardTokens[card] or {}) do
tokenData.token.locked = false
if tokenData.token ~= nil then
tokenData.token.locked = false
end
end
cardTokens[card] = nil
card.use_hands = true