Ignore:
Timestamp:
06/01/13 22:22:22 (12 years ago)
Author:
epyon
Message:
  • lua_glm - uses own naming scheme, made independent of nv/types.hh and it's type system
  • lua_glm - metatable lookup properly tied to registering table, custom naming possible again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_glm.cc

    r74 r75  
    66
    77#include "nv/lua/lua_glm.hh"
    8 #include "nv/types.hh"
    98#include "nv/string.hh"
    10 #include <new>
    119
    1210static size_t nlua_swizzel_lookup[256];
     
    224222        }
    225223
    226         lua_getglobal( L, nv::get_type_name<T>() );
    227         lua_pushvalue( L, -2 );
     224        lua_getmetatable( L, 1 );
     225        lua_getfield( L, -1, "__base" );
     226        lua_pushvalue( L, 2 );
    228227        lua_rawget( L, -2 );
    229 
    230228        return 1;
    231229}
     
    306304        };
    307305
    308         luaL_newmetatable( L, nv::get_type_name<T>() );
     306        luaL_newmetatable( L, nlua_metatable_name<T>() );
    309307        luaL_setfuncs( L, nlua_vec_m, 0 );
    310         lua_pop(L,1);
    311308        luaL_newlib(L, nlua_vec_f);
    312         lua_newtable( L );
     309        lua_pushvalue(L, -1);
     310        lua_setfield(L, -3, "__base" );
     311        lua_replace(L, -2);
     312    lua_newtable( L );
    313313        luaL_setfuncs( L, nlua_vec_fm, 0 );
    314314        lua_setmetatable( L, -2 );
     
    336336        nlua_swizzel_lookup['3'] = 3;
    337337        int stack = lua_gettop( L );
     338
    338339        luaL_requiref(L, "ivec2", luaopen_vec<glm::ivec2>, 1);
    339340        luaL_requiref(L, "ivec3", luaopen_vec<glm::ivec3>, 1);
Note: See TracChangeset for help on using the changeset viewer.