PROPERTY.C
LIB3/STD/BASIC/PROPERTY.C · 747 B
From the archive nm4dos.zip
Download the archive « Back to the archive contents
#pragma save_binary
mapping map_prop;
void create()
{
map_prop = ([ ]);
} /* create() */
int add_property( string var, mixed val )
{
if( !var )
return 0;
map_prop[ var ] = val;
return 1;
}
int remove_property( string var )
{
map_prop = m_delete( map_prop, var );
if( !map_prop )
map_prop = ([ ]);
return 1;
}
int query_property( string str )
{
return map_prop[ str ];
}
int query_property_exists( string str )
{
return( member_array( str, m_indices( map_prop ) ) ) != -1;
}
mapping query_properties()
{
return map_prop;
}
int add_properties( mapping map )
{
map_prop += map;
}
mixed * query_init_data()
{
return({ "properties", map_prop, "add_properties/p/" });
}