lua-users home
lua-l archive

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


Assuming I could buy it, does it cover toLua? I use that like, all the time. It's not in the ToC, but maybe it's hidden somewhere?

L-28C wrote:
AGAGAGAGA!! Amazon doesn't accept PayPal and I don't know where my card is. :-@

Will one of you peoples buy it for me? I'll send you the money (plus a little gratitude ;-) ) through PayPal.

Nah, you won't do that. Is there any other place I can get it from?

Thanks!

Wesley Smith wrote:
I've been writing Lua and Lua from C code about everyday for a year
now and I still find PiL invaluable.  Just yesterday in fact I looked
up how to write an 'ipairs' like function from C using userdata (p.
261).  If you look the book up on amazon, you can see the table of
contents.  A good portion of the book is on the C stuff.

wes

On 8/16/07, L-28C <kixdemp@gmail.com> wrote:
I've been reluctant to buy that because I thought it only covered the
basics of Lua coding, like, not the C API... But now that you say it
does, I have some questions:

1) What does it cover the most? I already know most of the "plain Lua"
part of it, I've made 2 games for the PSP Lua Player.
2) Is it the best book about it out there?

And back to the subject, it prints out just a number '1'... Looking at
the code, it seems it can either be a userdata or a table, so it's a
userdata... But what does the '1' mean?

Thanks for everything, Mr. Smith!

Wesley Smith wrote:
I would highly recommend picking up programming in Lua.  It has all
kind of stuff in there like this.  You will learn Lua much faster!

int stackDump(lua_State *L)
{
      int i;
      int top = lua_gettop(L);

      printf("stack dump %d:\n", top);
      for(i=top; i >= 1; i--) {
              int t = lua_type(L, i);

              switch(t)
              {
                      case LUA_TSTRING:
printf("%d \t'%s' string\n", i, lua_tostring(L, i));
                                      break;

                      case LUA_TBOOLEAN:
printf(lua_toboolean(L, i) ? "\ttrue\n" : "\tfalse\n");
                                      break;

                      case LUA_TNUMBER:
printf("%d \t'%f' number\n", i, lua_tonumber(L, i));
                                      break;

                      case LUA_TLIGHTUSERDATA:
printf("%d \t'%x'\n", i, lua_touserdata(L, i));
                                      break;

                      case LUA_TUSERDATA:
                                      printf("%d ", i);
                                      lua_getglobal(L, "print");
                                      lua_pushvalue(L, i);
                                      lua_call(L, 1, 0);
//printf("%d \t'%x %s'\n", i, lua_touserdata(L, i), T::name);
                                      break;

                      case LUA_TFUNCTION:
printf("%d \t'func: %x'\n", i, lua_tocfunction(L, i));
                                      break;

                      case LUA_TTABLE:
                                      printf("%d ", i);
                                      lua_getglobal(L, "print");
                                      lua_pushvalue(L, i);
                                      lua_call(L, 1, 0);
                                      break;

                      default:
printf("%d \t'%s'\n", i, lua_typename(L, t));
                                      break;
              }
      }

      return 0;
}