Thanks for the compliment Tack
Alas, it's a crazy ass time at work. Averaging about 65 hours a week, with super-extra overtime on weekends. Deadlines are deadlines, but at least things will quiet down just before we ship. Just a few more weeks...
Just to reassure - I haven't forgotten about Obsidian. I have, however, been struggling with the weirdest Lua error lately. Anyone familiar with Lua and binding to C, can you maybe cogitate over the following and offer some suggestions as to what might be the culprit?
<technical>
I'm generating Lua bindings where I start by registering metatables for each C++ class. I generate a C-function for __index, which contains a generated switch statement that compare a hash of the incoming string key with all of the members and methods defined in the class. It will return either the value of a member, or a C-function wrapper for a method. A similar C-function is generated for __tostring (prints the C++ class name) and __newindex (to assign values to members). These class metatables are added to the registry by using luaL_newmetatable with the fully qualified class name. Whenever I need to push such a C++ object into Lua, I create a light userdata set to the object pointer, get the registered metatable using luaL_getmetatable, and set it on the lightuserdata.
So far, so good - all according to examples from the Programming In Lua online book. Except... for some reason most lightuserdata will act as if the most recently retrieved metatable is set on them. So, given class Fortress, class Map and class Cell, each with a __tostring that prints the class type, I get the following:
> fortress = ReadFromDF()
> print(fortress)
Cell::Fortress
> map = fortress.Map
> print(map, fortress)
Cell::Map Cell::Fortress
Here comes the funky part:
> cell = map.Get(0, 0, 0)
> print(cell, map, fortress)
Cell::Cell Cell::Cell Cell::Fortress
See? The root object stays the same (it is actually a full userdata), but the light userdata references (cell and map) are set to the latest metatable retrieved.
Trying to debug this with commandline gdb in Windows is not helping. I've been wholly spoilt by Visual Studio's commercial debugger these last few years, and my brain is just too tired to learn gdb properly at this point. Anyone know of any good free mingw32-friendly debuggers (or good GUI frontend for gdb) on Windows, or do I need to whip out the Archlinux and try out KGdb etc?
</technical>
P.S. Don't even mention Visual C++ Express - yes, its free, but the free debugger smokes crundle butt-lint and the compiler can easily be curb-stomped by a furry wambler suffering from gastrointestinal stress.