Index: /trunk/nv/lib/detail/sdl_functions_20.inc
===================================================================
--- /trunk/nv/lib/detail/sdl_functions_20.inc	(revision 171)
+++ /trunk/nv/lib/detail/sdl_functions_20.inc	(revision 172)
@@ -302,2 +302,9 @@
 NV_SDL_FUN( int , SDL_GetNumTouchFingers, (SDL_TouchID touchID) );
 NV_SDL_FUN( SDL_Finger * , SDL_GetTouchFinger, (SDL_TouchID touchID, int index) ); 
+
+NV_SDL_FUN( char *, SDL_getenv, (const char *name) );
+NV_SDL_FUN( int , SDL_setenv, (const char *name, const char *value, int overwrite) );
+NV_SDL_FUN( int , SDL_isdigit, (int x) );
+NV_SDL_FUN( int , SDL_isspace, (int x) );
+NV_SDL_FUN( int , SDL_toupper, (int x) );
+NV_SDL_FUN( int , SDL_tolower, (int x) ); 
Index: /trunk/nv/lib/lua.hh
===================================================================
--- /trunk/nv/lib/lua.hh	(revision 171)
+++ /trunk/nv/lib/lua.hh	(revision 172)
@@ -363,6 +363,8 @@
 
 extern const lua_Number* (*lua_version) (lua_State *L);
+extern int LUA_UPVALUEINDEX;
 extern int LUA_REGISTRYINDEX;
 extern int LUA_VERSION_NUM;
+#define lua_upvalueindex(i)    (LUA_UPVALUEINDEX-(i))
 #define lua_tounsigned(L,idx) (lua_Number)lua_tointeger(L,idx)
 #define lua_pushunsigned(L,u) lua_pushinteger(L,(lua_Integer)u)
Index: /trunk/nv/position.hh
===================================================================
--- /trunk/nv/position.hh	(revision 171)
+++ /trunk/nv/position.hh	(revision 172)
@@ -41,5 +41,5 @@
 		 * @param p The position to assign the rectangle to.
 		 */
-		rectangle( position p ) : ul(p), lr(p) {}
+		explicit rectangle( position p ) : ul(p), lr(p) {}
 		
 		/**
@@ -152,4 +152,11 @@
 
 		/**
+		 * Gets the area of the rectangle.
+		 *
+		 * @returns The area of the rectangle, including the edge
+		 */
+		value_type get_enclosed_area() const { return (lr.y - ul.y + 1) * (lr.x - ul.x + 1); }
+
+		/**
 		 * Checks to see if the rectangle is backwards.
 		 *
Index: /trunk/src/gl/gl_window.cc
===================================================================
--- /trunk/src/gl/gl_window.cc	(revision 171)
+++ /trunk/src/gl/gl_window.cc	(revision 172)
@@ -28,4 +28,14 @@
 	{
 		kevent.key.ascii = static_cast<char8>( ucode );
+#if NV_SDL_VERSION == NV_SDL_20
+		if (ucode >= 'a' && ucode <= 'z')
+		{
+			int shifted = !!(ke.keysym.mod & KMOD_SHIFT);
+			int capslock = !!(ke.keysym.mod & KMOD_CAPS);
+			if ((shifted ^ capslock) != 0) {
+				kevent.key.ascii = SDL_toupper(ucode);
+			}
+		}
+#endif
 	}
 
Index: /trunk/src/lib/lua.cc
===================================================================
--- /trunk/src/lib/lua.cc	(revision 171)
+++ /trunk/src/lib/lua.cc	(revision 172)
@@ -45,4 +45,5 @@
 #	include <nv/lib/detail/lua_functions_compat.inc>
 #	undef NV_LUA_COMPAT_FUN
+int LUA_UPVALUEINDEX  = 0;
 int LUA_REGISTRYINDEX = 0;
 int LUA_VERSION_NUM   = 0;
@@ -266,4 +267,5 @@
 		NV_LUA_LOAD( luaL_getsubtable );
 
+		LUA_UPVALUEINDEX  = LUA_REGISTRYINDEX_52;
 		LUA_REGISTRYINDEX = LUA_REGISTRYINDEX_52;
 		LUA_VERSION_NUM   = 502;
@@ -292,4 +294,5 @@
 		NV_LUA_LOAD( lua_equal );
 		lua_compare       = lua_compare_51;
+		LUA_UPVALUEINDEX  = LUA_GLOBALSINDEX_51;
 		LUA_REGISTRYINDEX = LUA_REGISTRYINDEX_51;
 		LUA_VERSION_NUM   = 501;
Index: /trunk/src/lua/lua_glm.cc
===================================================================
--- /trunk/src/lua/lua_glm.cc	(revision 171)
+++ /trunk/src/lua/lua_glm.cc	(revision 172)
@@ -340,4 +340,5 @@
 	int stack = lua_gettop( L );
 
+	luaL_requiref(L, "coord", luaopen_vec<nv::ivec2>, 1);
 	luaL_requiref(L, "ivec2", luaopen_vec<nv::ivec2>, 1);
 	luaL_requiref(L, "ivec3", luaopen_vec<nv::ivec3>, 1);
