[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Make sure numbers are numbers
- From: HyperHacker <hyperhacker@...>
- Date: Sun, 18 Apr 2010 22:42:54 -0600
On Sun, Apr 18, 2010 at 22:09, Patrick Donnelly <batrick@batbytes.com> wrote:
> On Sun, Apr 18, 2010 at 11:51 PM, Pan Shi Zhu <pan.shizhu@gmail.com> wrote:
>> in C, the lua_tonumber() is an in-place convertion, it changes the
>> value in stack and may cause unwanted behavior when you're iterating a
>> table.
>
> This is not true. lua_tonumber and its variants do not change the
> value of the stack location. It converts the value to a number and
> returns that number.
>
> --
> - Patrick Donnelly
>
Correct, according to the manual, lua_tolstring (and lua_tostring)
perform in-place conversion of numbers, while lua_tonumber and others
do not.
--
Sent from my toaster.