lundiorg/lundi — pull request #26 by kbok (2013-09-24 21:30:34+00:00)
Title: Draft for tables support

This is a "fixed" version of the first branch commit I submitted some time ago.

## THIS BREAKS EVERYTHING

It is a rough version that demonstrates the way I see tables *could* work in lundi.

- I have not taken into account yet @Ambeco's suggestions. I will.
- The way references are one of the variant's supported types maybe changed. I think it makes sense, but not for tables.
- Tables are meant to be constructed from references (it's just an interface). There should be a way to check if the referenced object is indeed a table when constructing.
- Not having tables in the variant means we have to make a special case for them in the different binding entry points (exposing functions, proxies, etc)
- The reference type is a handle to a table entry inside lua. The index is *the identity of the C++ reference object itself*. Therefore, we get reference counting for free (implemented inside lua). However, copying is more expensive than if we used `luaL_ref` and a C++ reference counter.
- I moved push/pop to `variant.hpp` and tried to tidy up the dependencies between classes. I think there's too much stuff in `state`.
- We need to implement range compatibility
- I am NOT HAPPY with the way I handled push and pop