lua-users home
lua-l archive

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


It is a more efficient way of doing it, so long as you want to keep
the remainder. It may well be more efficient even if you don't want to
keep the remainder, but I'm less sure of that.

Peter

2008/9/25 David Given <dg@cowlark.com>:
> Mike Pall wrote:
> [...]
>>   local r = remaining % 256
>>   string.char(112 + (remaining-r)/256, r)
>
> Is this the preferred approach to using math.floor() (which is what I
> usually end up with when converting things to integers)?
>
> --
> David Given
> dg@cowlark.com
>