lua-users home
lua-l archive

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

David Manura wrote:
On Fri, Jan 9, 2009 at 10:29 PM, James Rhodes wrote:
 cout << i << ": string : " << lua_tostring(lstack,i) << endl;\

Careful: lua_tostring has side-effects[1] (perhaps the name of this
function is misleading).  It's also more correct to do
"if(lua_toboolean(lstack,i) != 0)" .


Was my first thought too... but perhaps cleverly accidently he checks that it isn't a number before checking if it's a string. So side effect free :)

Must say though stack watches are brilliant for working with the lua stack, although writing a good table printer without side effects/recursion problems is hard.

- Alex