lua-users home
lua-l archive

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


Marinho Brandao wrote:
[...]
> dir() - that shows all attributes and methods that an object has

function dir(object)
  for k,v in pairs(object) do
    print(k, v)
  end
end

> help() - that shows the documenatation about builtin functions and modules

There isn't any builtin help in Lua, but this link:

http://www.lua.org/manual/5.1/#index

...is worth bookmarking.

> str() - that converts everything to string

tostring(). Most Lua objects do *not* autoconvert to strings. However,
most pure-Lua complex objects will just render as 'table: 0xdecafbad'
unless they have specific support for rendering themselves more
usefully. C-based complex objects usually produce some description of
themselves, though.

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

Attachment: signature.asc
Description: OpenPGP digital signature