Index: trunk/src/lua/lua_glm.cc
===================================================================
--- trunk/src/lua/lua_glm.cc	(revision 176)
+++ trunk/src/lua/lua_glm.cc	(revision 177)
@@ -9,4 +9,5 @@
 #include "nv/lua/lua_raw.hh"
 #include "nv/string.hh"
+#include "nv/random.hh"
 
 static size_t nlua_swizzel_lookup[256];
@@ -24,4 +25,5 @@
 template < typename T, size_t k >
 struct nlua_vec_constructor {
+	static inline T unit() { return T(); }
 	static inline T construct( lua_State*, int ) {
 		return T();
@@ -30,4 +32,5 @@
 
 template < typename T > struct nlua_vec_constructor< T, 1 > {
+	static inline T unit() { return T( 1 ); }
 	static inline T construct( lua_State* L, int index ) {
 		return T( lua_tonumber( L, index ) );
@@ -36,4 +39,5 @@
 
 template < typename T > struct nlua_vec_constructor< T, 2 > {
+	static inline T unit() { return T( 1, 1 ); }
 	static inline T construct( lua_State* L, int index ) {
 		if ( lua_type( L, index ) == LUA_TUSERDATA )
@@ -45,4 +49,5 @@
 
 template < typename T > struct nlua_vec_constructor< T, 3 > {
+	static inline T unit() { return T( 1, 1, 1 ); }
 	static inline T construct( lua_State* L, int index ) {
 		typedef glm::detail::tvec2<typename T::value_type> vec2;
@@ -65,4 +70,5 @@
 
 template < typename T > struct nlua_vec_constructor< T, 4 > {
+	static inline T unit() { return T( 1, 1, 1, 1 ); }
 	static inline T construct( lua_State* L, int index ) {
 		typedef glm::detail::tvec2<typename T::value_type> vec2;
@@ -113,4 +119,11 @@
 
 template< typename T >
+int nlua_vec_random( lua_State* L )
+{
+	nlua_push_vec<T>( L, nv::random::get().range( nlua_to_vec<T>( L, 1 ), nlua_to_vec<T>( L, 2 ) ) );
+	return 1;
+}
+
+template< typename T >
 int nlua_vec_clone( lua_State* L )
 {
@@ -118,5 +131,4 @@
 	return 1;
 }
-
 
 template< typename T >
@@ -291,4 +303,5 @@
 	static const struct luaL_Reg nlua_vec_sf [] = {
 		{ "new",            nlua_vec_new<T> },
+		{ "random",         nlua_vec_random<T> },
 		{NULL, NULL}
 	};
@@ -297,4 +310,5 @@
 		{ "clone",          nlua_vec_clone<T> },
 		{ "get",            nlua_vec_get<T> },
+		{ "tostring",       nlua_vec_tostring<T> },
 		{NULL, NULL}
 	};
@@ -330,4 +344,9 @@
 	nlua_register( L, nlua_vec_sm, -1 );
 	lua_setmetatable( L, -2 );
+
+	nlua_push_vec( L, T() );
+	lua_setfield( L, -2, "ZERO" );
+	nlua_push_vec( L, nlua_vec_constructor<T,sizeof( T ) / sizeof( typename T::value_type )>::unit() );
+	lua_setfield( L, -2, "UNIT" );
 	return 1;
 }
