- Timestamp:
- 07/17/15 13:39:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_state.cc
r406 r426 180 180 lua_getfield( m_state, -1, element.data() ); 181 181 bool result = !( lua_isnil( m_state, -1 ) ); 182 lua_pop( m_state, 1 ); 183 return result; 184 } 185 186 uint64 nv::lua::table_guard::get_string_hash_64( string_view element, uint64 defval /*= 0 */ ) 187 { 188 lua_getfield( m_state, -1, element.data() ); 189 size_t l = 0; 190 const char* str = nullptr; 191 uint64 result = defval; 192 if ( lua_type( m_state, -1 ) == LUA_TSTRING ) 193 { 194 str = lua_tolstring( m_state, -1, &l ); 195 result = hash_string< uint64 >( str, l ); 196 } 182 197 lua_pop( m_state, 1 ); 183 198 return result; … … 253 268 return result; 254 269 } 255 256 270 257 271 float nv::lua::table_guard::get_float( string_view element, float defval /*= 0.0 */ )
Note: See TracChangeset
for help on using the changeset viewer.