src/virtualwalls.cpp
// initializeVirtualWalls *******
// Initialize our TAD of virtual walls

initializeVirtualWalls
Initialize our TAD of virtual walls
initializeVirtualWalls Initialize our TAD of virtual walls
bool initializeVirtualWalls()
{
	int i;
	lua_State* lstate;
	int value;
	if (initialized) return false;
	initialized=true;
	lstate=scriptMan.getLuaObject();
	lWallSize=scriptMan.getIntVariable("leftWallSize");
	rWallSize=scriptMan.getIntVariable("rightWallSize");
	gWallSize=scriptMan.getIntVariable("groundWallSize");
	virtualWallLeft=new int[lWallSize];
	virtualWallRight=new int[rWallSize];
	virtualWallGround=new int[gWallSize];
	for (i=0; i<lWallSize; i++) {
		lua_getglobal(lstate, "leftVirtualWall");
		lua_pushnumber(lstate, i);
		lua_gettable(lstate, -2);
		value=int(lua_tonumber(lstate, -1));
		lua_pop(lstate, 2);
		virtualWallLeft[i]=value;
	}
	for (i=0; i<rWallSize; i++) {
		lua_getglobal(lstate, "rightVirtualWall");
		lua_pushnumber(lstate, i);
		lua_gettable(lstate, -2);
		value=int(lua_tonumber(lstate, -1));
		lua_pop(lstate, 2);
		virtualWallRight[i]=value;
	}
	for (i=0; i<gWallSize; i++) {
		lua_getglobal(lstate, "groundVirtualWall");
		lua_pushnumber(lstate, i);
		lua_gettable(lstate, -2);
		value=int(lua_tonumber(lstate, -1));
		lua_pop(lstate, 2);
		virtualWallGround[i]=value;
	}
	return true;
}
bool initializeVirtualWalls ( ) { int i ; lua_State * lstate ; int value ; if ( initialized ) return false ; initialized = true ; lstate = scriptMan . getLuaObject ( ) ; lWallSize = scriptMan . getIntVariable ( " " ) ; rWallSize = scriptMan . getIntVariable ( " " ) ; gWallSize = scriptMan . getIntVariable ( " " ) ; virtualWallLeft = new int [ lWallSize ] ; virtualWallRight = new int [ rWallSize ] ; virtualWallGround = new int [ gWallSize ] ; for ( i = 0 ; i < lWallSize ; i ++ ) { lua_getglobal ( lstate , " " ) ; lua_pushnumber ( lstate , i ) ; lua_gettable ( lstate , -2 ) ; value = int ( lua_tonumber ( lstate , -1 ) ) ; lua_pop ( lstate , 2 ) ; virtualWallLeft [ i ] = value ; } for ( i = 0 ; i < rWallSize ; i ++ ) { lua_getglobal ( lstate , " " ) ; lua_pushnumber ( lstate , i ) ; lua_gettable ( lstate , -2 ) ; value = int ( lua_tonumber ( lstate , -1 ) ) ; lua_pop ( lstate , 2 ) ; virtualWallRight [ i ] = value ; } for ( i = 0 ; i < gWallSize ; i ++ ) { lua_getglobal ( lstate , " " ) ; lua_pushnumber ( lstate , i ) ; lua_gettable ( lstate , -2 ) ; value = int ( lua_tonumber ( lstate , -1 ) ) ; lua_pop ( lstate , 2 ) ; virtualWallGround [ i ] = value ; } return true ; }
initializeVirtualWalls 
Initialize our TAD of virtual walls
initializeVirtualWalls Initialize our TAD of virtual walls
// check for initialization problems
 // get the lua state object
 // set wallSize's value
 // allocate memory
 // fill left wall with the right values
 // get leftVirtualWal[i]
 // save the value
 // fill right wall with the right values
 // get rightVirtualWal[i]
 // save the value
 // fill ground wall with the right values
 // get groundVirtualWal[i]
 // save the value
 // all ok
