lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Another thing to think about with % vs. math.mod()... % can be
overloaded if I'm not mistaken. :>  __mod?

On Sun, Feb 7, 2010 at 10:22 AM, Eike Decker <zet23t@googlemail.com> wrote:
> As a side note:
> math.mod is already different from % :
>
>> =-3%2
> 1
>> =math.mod(-3,2)
> -1
>>
>
> ... when it comes to negative numbers it's behaving differently.
>
>
> Eike
>
> 2010/2/7 Philippe Lhoste <PhiLho@gmx.net>:
>> On 07/02/2010 11:45, Attila wrote:
>>>
>>> Functions table.foreach and table.foreachi are deprecated. You can use a
>>> for loop with pairs or ipairs instead.
>>> Since table.getn/maxn does (now rather did) the same job, they have been
>>> also deprecated.
>>
>> Deprecated means: don't use them in new code. And: it might disappear in a
>> future version.
>>
>> In Java API, you will find lot of methods that have been deprecated for
>> years, but are still there to let run .jar files made for Java 1.1...
>> Perhaps deprecated functions in Lua will disappear in next major version.
>>
>>> (but strange, math.mod disappeared, and
>>> just fmod and modf are there...)
>>
>> If I am not mistaken, math.mod does the same thing than % but fmod and modf
>> do slightly different things (eg. with negative numbers).
>>
>> --
>> Philippe Lhoste
>> --  (near) Paris -- France
>> --  http://Phi.Lho.free.fr
>> --  --  --  --  --  --  --  --  --  --  --  --  --  --
>>
>>
>