Truxton artifact save

From truxwiki.com
Revision as of 09:43, 10 November 2020 by Sam (talk | contribs)
Jump to navigation Jump to search

This saves an artifact object. The data in the artifact object will be written to the [Entity] table in the database.

Syntax

int truxton_artifact_save(uint64_t artifact_handle);

Parameters

artifact_handle

The artifact instance. This handle comes from calling truxton_artifact_create().

Return value

A non-zero value on success, zero on failure.

Sample

void create_artifact(void)
{
   uint64_t truxton = truxton_create();

   uint64_t artifact= truxton_artifact_create(truxton);

   truxton_artifact_set_name( artifact, "Ducky Momo Server" );
   truxton_artifact_save( artifact);
   truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );

   char id[ 65 ];

   truxton_artifact_get_id( artifact, id, sizeof( id ) );

   printf( "Artifact ID is %s\n", id );

   truxton_artifact_destroy(media);
   truxton_destroy(truxton);
}