   Problems with reading global data with luabind [SOLVED]
  EDIT-Turns out it was a problem with the lua file format.This version works fine:ConfigTable ={MaxFps = 50,Fullscreen = 0,GraphicsFolder = "../data/graphics/",AnimationFolder = "../data/animation/",EntityFolder = "../data/entity/"}I just started adding lua scripting support with luabind for my game and ran into a problem with accessing global data from lua_State.I have the game configuration options in following file:CONFIG.luaConfigTable = {}configTable["MaxFps"] = 50configTable["Fullscreen"] = 0configTable["GraphicsFolder"] = "../data/graphics/"configTable["AnimationFolder"] = "../data/animation/"configTable["EntityFolder"] = "../data/entity/"I then load the file with this code:VInitialize(char const * initFileName, GameConfig & gameConfig){lua_State * configState = luaL_newstate();    luabind::open(configState);    luaL_dofile(configState, initFileName);    {   luabind::object global = luabind::globals(configState);   luabind::object configTable = global["ConfigTable"];   if( luabind::type(configTable) != LUA_TTABLE )   {  LogError("Config file ConfigTable is not a table!");  return false;   }   gameConfig.ParseLuaTable(configTable);    }    lua_close(configState);    return true;}So far all works well. But in then...bool GameConfig::ParseLuaTable(luabind::adl::object const & configTable){    m_maxFps  = luabind::object_cast<int>(configTable["MaxFps"]);    m_startInFullscreen = luabind::object_cast<int>(configTable["Fullscreen"]);    m_folders[eCONFIG_GRAPHICS]   = luabind::object_cast<std::string>(configTable["GraphicsFolder"]);    m_folders[eCONFIG_ANIMATIONS] = luabind::object_cast<std::string>(configTable["AnimationFolder"]);    m_folders[eCONFIG_ENTITIES]   = luabind::object_cast<std::string>(configTable["EntityFolder"]);    return true;}Here the program crashes on the first object_cast with the following error:terminate called after throwing an instance of 'luabind::cast_failed'  what():  unable to make castIt seems like the data in ConfigTable isn't defined properly, or something.The code worked when I retrieved the table by making the lua script a function returning it, but shouldn't the current version work as well? I'm just trying to access global data defined in the lua file.This is my first time using lua, so please tell me if I'm doing something really wrong here.Thanks in advance.[Edited by - Hlan on April 24, 2010 2:36:18 PM]