Ignore:
Timestamp:
05/29/15 12:12:47 (10 years ago)
Author:
epyon
Message:
  • important fix in reverse_iterator operators
  • std::string functions removed or converted to string_ref in string.hh
  • capi.hh - more function forwards and usage of them instead of libc
  • more std removal
  • assert fix
File:
1 edited

Legend:

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

    r369 r378  
    88
    99#include "nv/lua/lua_raw.hh"
    10 #include "nv/stl/string.hh"
    1110#include "nv/core/random.hh"
     11#include "nv/stl/traits/common.hh"
    1212
    1313static size_t nlua_swizzel_lookup[256];
     
    292292{
    293293        T v = to_vec<T>( L, 1 );
    294         std::string s = "(";
    295         for ( size_t i = 0; i < v.length(); ++i )
    296         {
    297                 if (i > 0) s += ",";
    298                 s += nv::to_string(v[i]);
    299         }
    300         s+=")";
    301         lua_pushstring( L, s.c_str() );
     294        bool fl = nv::is_floating_point<typename T::value_type>::value;
     295        switch ( v.length() )
     296        {
     297        case 1: lua_pushfstring( L, ( fl ? "(%f)"          : "(%d)" ),          v[0] );
     298        case 2: lua_pushfstring( L, ( fl ? "(%f,%f)"       : "(%d,%d)" ),       v[0], v[1] );
     299        case 3: lua_pushfstring( L, ( fl ? "(%f,%f,%f)"    : "(%d,%d,%d)" ),    v[0], v[1], v[2] );
     300        case 4: lua_pushfstring( L, ( fl ? "(%f,%f,%f,%f)" : "(%d,%d,%d,%d)" ), v[0], v[1], v[2], v[3] );
     301        default:
     302                lua_pushliteral( L, "(vector?)" ); break;
     303        }
    302304        return 1;
    303305}
Note: See TracChangeset for help on using the changeset viewer.