Skip to content

Tagha API Reference

assyrianic edited this page Jul 14, 2018 · 64 revisions

API Functions/Methods

void Tagha_Init(struct Tagha *vm, void *script);
  • intializes the Tagha VM with a script pointer.
void Tagha_InitN(struct Tagha *vm, void *script, const struct NativeInfo natives[]);
  • intializes the Tagha VM with a script pointer and registers a set array of natives in one go.
int32_t Tagha_RunScript(struct Tagha *vm, int32_t args, char *argvector[]);
  • executes a script loaded on the vm until the script halts, returns on empty stack, or an error occurs.
bool Tagha_RegisterNatives(struct Tagha *vm, const struct NativeInfo natives[]);
  • registers an array of natives to Tagha's native map. returns true on success, false on failure. false can occur if vm or natives is NULL, or Natives Hashmap methods returns false.
int32_t Tagha_CallFunc(struct Tagha *vm, const char *funcname, size_t args, union Value values[]);
  • matches strFunc in a script's function table to invoke the function's instructions.
void *Tagha_GetGlobalVarByName(struct Tagha *vm, const char *varname);
  • matches varname in a script's var table to retrieve the address of the global variable and returns it as a void * pointer. Returns NULL if the variable doesn't exist.
union Value Tagha_GetReturnValue(struct Tagha *vm);
  • gets the value of the VM's Alaf register.

Clone this wiki locally