Difference between revisions of "Truxton artifact save"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This saves an artifact object. The data in the artifact object will be written to the <code><nowiki>[</nowiki>Entity<nowiki>]</nowiki></code> table in the dat...")
 
Line 3: Line 3:
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
 
int truxton_artifact_save(uint64_t artifact_handle);
 
int truxton_artifact_save(uint64_t artifact_handle);
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 16: Line 16:
  
 
=Sample=
 
=Sample=
<syntaxhighlight lang="C" highlight="8">
+
<source lang="C" highlight="8">
 
void create_artifact(void)
 
void create_artifact(void)
 
{
 
{
Line 36: Line 36:
 
   truxton_destroy(truxton);
 
   truxton_destroy(truxton);
 
}
 
}
</syntaxhighlight>
+
</source>

Revision as of 09:43, 10 November 2020

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);
}