Difference between revisions of "Truxton artifact create"
Jump to navigation
Jump to search
(Created page with "This creates an artifact object. Internally, Truxton calls these entities. You can use this to add to the <code>Entity</code> table in the database. =Syntax= <syntaxhighlight...") |
|||
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This creates an artifact object. | This creates an artifact object. | ||
Internally, Truxton calls these entities. | Internally, Truxton calls these entities. | ||
| − | You can use this to add to the <code>Entity</code> table in the database. | + | You can use this to add records to the <code><nowiki>[</nowiki>[[Entity Table|Entity]]<nowiki>]</nowiki></code> table in the database. |
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
| − | uint64_t truxton_artifact_create(uint64_t truxton_handle); | + | uint64_t truxton_artifact_create( uint64_t truxton_handle ); |
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
| Line 17: | Line 17: | ||
=Sample= | =Sample= | ||
| − | < | + | <source lang="C" highlight="5"> |
| − | void create_artifact(void) | + | void create_artifact( void ) |
{ | { | ||
uint64_t truxton = truxton_create(); | uint64_t truxton = truxton_create(); | ||
| − | uint64_t artifact= truxton_artifact_create(truxton); | + | uint64_t artifact= truxton_artifact_create( truxton ); |
truxton_artifact_set_name( artifact, "Ducky Momo Server" ); | truxton_artifact_set_name( artifact, "Ducky Momo Server" ); | ||
| − | truxton_artifact_save( artifact); | + | truxton_artifact_save( artifact ); |
truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 ); | truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 ); | ||
| Line 34: | Line 34: | ||
printf( "Artifact ID is %s\n", id ); | printf( "Artifact ID is %s\n", id ); | ||
| − | truxton_artifact_destroy( | + | truxton_artifact_destroy( artifact ); |
| − | truxton_destroy(truxton); | + | truxton_destroy( truxton ); |
} | } | ||
| − | </ | + | </source> |
| − | |||
| − | |||
| − | |||
Latest revision as of 04:30, 13 February 2021
This creates an artifact object.
Internally, Truxton calls these entities.
You can use this to add records to the [Entity] table in the database.
Syntax
uint64_t truxton_artifact_create( uint64_t truxton_handle );
Parameters
truxton_handle
The Truxton instance this artifact will belong.
This handle comes from calling truxton_create().
Return value
A handle to an artifact object.
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( artifact );
truxton_destroy( truxton );
}