Indexing of non-table object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Indexing of non-table object

Alexander Gladysh
Hi, all!

Sometimes (and it is not very rare case) I need to write a C-function,
which accepts only Lua tables. Now I have to write code like this:

  void MyFunction(const luabind::object & table)
    if (luabind::type(table) != LUA_TTABLE)
      const lua_State * L = table.interpreter();
      lua_pushstring("Table expected");

    // Index table variable

This usage is inconsistent with most of other cases, there I work on
level of end-user types, registered within Luabind.

While I like the abstraction level luabind::object provides, it would
be nice to have more high-level alternative for such usage pattern.
May be some luabind::table, with built-in parameter type validation
like one provided for user-registered types?

Am I missing something?

Thanks in advance,

luabind-user mailing list
[hidden email]