- Timestamp:
- 07/25/13 15:07:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_glm.cc
r172 r174 108 108 int nlua_vec_new( lua_State* L ) 109 109 { 110 nlua_push_vec( L, nlua_vec_constructor<T,sizeof( T ) / sizeof( typename T::value_type )>::construct( L, 1 ) ); 111 return 1; 112 } 110 nlua_push_vec<T>( L, nlua_vec_constructor<T,sizeof( T ) / sizeof( typename T::value_type )>::construct( L, 1 ) ); 111 return 1; 112 } 113 114 template< typename T > 115 int nlua_vec_clone( lua_State* L ) 116 { 117 nlua_push_vec<T>( L, nlua_to_vec<T>( L, 1 ) ); 118 return 1; 119 } 120 113 121 114 122 template< typename T > 115 123 int nlua_vec_call( lua_State* L ) 116 124 { 117 nlua_push_vec ( L, nlua_vec_constructor<T,sizeof( T ) / sizeof( typename T::value_type )>::construct( L, 2 ) );125 nlua_push_vec<T>( L, nlua_vec_constructor<T,sizeof( T ) / sizeof( typename T::value_type )>::construct( L, 2 ) ); 118 126 return 1; 119 127 } … … 224 232 } 225 233 226 luaL_getmetafield( L, 1, "__ base" );234 luaL_getmetafield( L, 1, "__functions" ); 227 235 lua_pushvalue( L, 2 ); 228 236 lua_rawget( L, -2 ); … … 281 289 int luaopen_vec( lua_State * L ) 282 290 { 291 static const struct luaL_Reg nlua_vec_sf [] = { 292 { "new", nlua_vec_new<T> }, 293 {NULL, NULL} 294 }; 295 283 296 static const struct luaL_Reg nlua_vec_f [] = { 284 { " new", nlua_vec_new<T> },297 { "clone", nlua_vec_clone<T> }, 285 298 { "get", nlua_vec_get<T> }, 286 299 {NULL, NULL} 287 300 }; 288 301 289 static const struct luaL_Reg nlua_vec_ fm [] = {302 static const struct luaL_Reg nlua_vec_sm [] = { 290 303 { "__call", nlua_vec_call<T> }, 291 304 {NULL, NULL} … … 309 322 lua_createtable( L, 0, 0 ); 310 323 nlua_register( L, nlua_vec_f, -1 ); 311 lua_ pushvalue(L, -1);312 lua_ setfield(L, -3, "__base");313 lua_replace(L, -2); 324 lua_setfield(L, -2, "__functions" ); 325 lua_pop( L, 1 ); 326 314 327 lua_createtable( L, 0, 0 ); 315 nlua_register( L, nlua_vec_fm, -1 ); 328 nlua_register( L, nlua_vec_sf, -1 ); 329 lua_createtable( L, 0, 0 ); 330 nlua_register( L, nlua_vec_sm, -1 ); 316 331 lua_setmetatable( L, -2 ); 317 332 return 1;
Note: See TracChangeset
for help on using the changeset viewer.