- msg_Warn( p_this, "Custom meta data category name must be "
- "a string" );
- }
- else if( !lua_istable( L, -1 ) )
- {
- msg_Warn( p_this, "Custom meta data category contents "
- "must be a table" );
- }
- else
- {
- const char *psz_meta_category = lua_tostring( L, -2 );
- msg_Dbg( p_this, "Found custom meta data category: %s",
- psz_meta_category );
- lua_pushnil( L );
- /* ... item meta key value nil */
- while( lua_next( L, -2 ) )
- {
- /* ... item meta key value key2 value2 */
- if( !lua_isstring( L, -2 ) )
- {
- msg_Warn( p_this, "Custom meta category item name "
- "must be a string." );
- }
- else if( !lua_isstring( L, -1 ) )
- {
- msg_Warn( p_this, "Custom meta category item value "
- "must be a string." );
- }
- else
- {
- const char *psz_meta_name =
- lua_tostring( L, -2 );
- const char *psz_meta_value =
- lua_tostring( L, -1 );
- msg_Dbg( p_this, "Custom meta %s, %s: %s",
- psz_meta_category, psz_meta_name,
- psz_meta_value );
- input_item_AddInfo( p_input, psz_meta_category,
- psz_meta_name, "%s", psz_meta_value );
- }
- lua_pop( L, 1 ); /* pop item */
- /* ... item meta key value key2 */
- }
- /* ... item meta key value */