-- $LastChangedDate: 2011-03-17 19:59:52 -0400 (Thu, 17 Mar 2011) $
-- Macros written in Lua to expand C++ code for bindings between C++/Lua.
-- Avoid lua_/LUA_ which is reserved by Lua.

bindTable = {

class = "ConfBin",
typesig = nil,
luaCanInstantiate = false,

headers =
[[
#include "base/module.hh"
#include "base/conf_bin.hh"
using namespace base;
#include "glue/module.hh"
#include "glue/conf_bin_ext.hh"
using namespace glue;
]],

func_ReadInt = {
    comments = "true,number or false,nil ConfBin:ReadInt( key )",
    code = [[
        const string key = POP_STRING( L );
        int val = 0;
        const bool res = glue::GetConfBin().Read( key, val );
        if ( res )
        {
            lua_pushboolean( L, true );
            lua_pushnumber( L, val );
        }
        else
        {
            lua_pushboolean( L, false );
            lua_pushnil( L );
        }
        return 2;  // stack items to return
    ]]
},

func_WriteInt = {
    comments = "bool ConfBin:WriteInt( key, val )",
    code = [[
        const int    val = POP_INT( L );
        const string key = POP_STRING( L );
        const bool res = glue::GetConfBin().Write( key, val );
        lua_pushboolean( L, res );
        return 1;  // stack items to return
    ]]
},

}
