minor code improvement

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Zul
Wayist
Posts: 28
Joined: Sun Oct 27, 2013 2:45 am

minor code improvement

#1 Post by Zul »

In
game/modules/tome/data/timed_effects/physical.lua
I found the following code:

Code: Select all

local normalize_direction = function(direction)
    local pi2 = math.pi * 2
    while direction > pi2 do
        direction = direction - pi2
    end
    while direction < 0 do
        direction = direction + pi2
    end
    return direction
end
Using the builtin % operator, this can be rewritten in a more efficient and concise way:

Code: Select all

local normalize_direction = function(direction)
    return direction % (2*math.pi)
end

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: minor code improvement

#2 Post by darkgod »

done
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply