Changeset 534 for trunk/src/lua
- Timestamp:
- 01/12/17 14:41:17 (8 years ago)
- Location:
- trunk/src/lua
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_math.cc
r529 r534 11 11 #include "nv/stl/type_traits/common.hh" 12 12 13 static size_t nlua_swizzel_lookup[256]; 13 using nv::uint32; 14 static nv::uint32 nlua_swizzel_lookup[256]; 14 15 15 16 using nv::lua::detail::is_vec; … … 18 19 using nv::lua::detail::push_vec; 19 20 20 inline bool nlua_is_swizzel( const unsigned char* str, size_tmax )21 inline bool nlua_is_swizzel( const unsigned char* str, nv::uint32 max ) 21 22 { 22 23 while (*str) … … 229 230 { 230 231 T v = to_vec<T>( L, 1 ); 231 for ( size_ti = 0; i < v.size(); ++i )232 for ( uint32 i = 0; i < v.size(); ++i ) 232 233 { 233 234 lua_pushnumber( L, v[i] ); … … 241 242 T* v = to_pvec<T>( L, 1 ); 242 243 size_t len = 0; 243 size_tvlen = v->size();244 uint32 vlen = v->size(); 244 245 const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) ); 245 size_tidx = 255;246 uint32 idx = 255; 246 247 247 248 if ( len == 1 ) … … 279 280 T* v = to_pvec<T>( L, 1 ); 280 281 size_t len = 0; 281 size_tvlen = v->size();282 uint32 vlen = v->size(); 282 283 const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) ); 283 size_tidx = 255;284 uint32 idx = 255; 284 285 if( len == 1 ) 285 286 { … … 294 295 { 295 296 switch (len) { 296 case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( size_ti = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0;297 case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( size_ti = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0;298 case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( size_ti = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0;297 case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0; 298 case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0; 299 case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0; 299 300 default: break; 300 301 } … … 405 406 void nv::lua::register_math( lua::state* state ) 406 407 { 407 for ( size_ti = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;408 for (uint32 i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255; 408 409 using nv::uchar8; 409 410 nlua_swizzel_lookup[uchar8( 'x' )] = 0; -
trunk/src/lua/lua_nova.cc
r490 r534 91 91 if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0) 92 92 { 93 luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) );93 luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, (int)lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) ); 94 94 } 95 95 break; … … 296 296 lua_rawget( L, 1 ); 297 297 int count = 0; 298 if ( !lua_isnil( L, -1 ) ) count = lua_tointeger( L, -1 );298 if ( !lua_isnil( L, -1 ) ) count = (int)lua_tointeger( L, -1 ); 299 299 lua_pop( L, 1 ); 300 300 count++; … … 358 358 static int nova_create_seq_function_closure( lua_State * L ) 359 359 { 360 int fc = lua_tointeger( L, lua_upvalueindex( 1 ) );360 int fc = (int)lua_tointeger( L, lua_upvalueindex( 1 ) ); 361 361 int args = lua_gettop( L ); 362 362 for ( int fi = 1; fi <= fc; fi++ ) -
trunk/src/lua/lua_path.cc
r490 r534 16 16 string_view spath( m_elements[0].str, m_elements[0].length ); 17 17 m_count = 0; 18 size_tpoint = spath.find( '.' );18 uint32 point = spath.find( '.' ); 19 19 20 20 while ( point != string_view::npos ) -
trunk/src/lua/lua_raw.cc
r494 r534 331 331 int nlua_rawlen( lua_State* L, int index ) 332 332 { 333 return lua_objlen( L, index);333 return static_cast<int>( lua_objlen( L, index ) ); 334 334 } 335 335 -
trunk/src/lua/lua_state.cc
r533 r534 911 911 if ( lua_type( state->get_raw(), index ) == LUA_TBOOLEAN ) 912 912 { 913 *value = bool( lua_toboolean( state->get_raw(), index ) );913 *value = lua_toboolean( state->get_raw(), index ) != 0; 914 914 return true; 915 915 } -
trunk/src/lua/lua_types.cc
r503 r534 1 // Copyright (C) 2016-201 6ChaosForge Ltd1 // Copyright (C) 2016-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 85 85 { 86 86 int error; // proper type instead of sint32? 87 *(sint32*)object = lua_tointeger( lstate, index );87 *(sint32*)object = (sint32)lua_tointeger( lstate, index ); 88 88 return true; 89 89 } -
trunk/src/lua/lua_values.cc
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 //
Note: See TracChangeset
for help on using the changeset viewer.