Search code examples
chaxe

What are neko_vm_custom() and neko_vm_set_custom() for?


I am embedding Neko VM into my desktop application. I did a lot of searching, but I am still unable to find out any helpful information regarding these 2 functions, which are declared in the neko_vm.h:

void *neko_vm_custom( neko_vm *vm, vkind k );
void neko_vm_set_custom( neko_vm *vm, vkind k, void *v );

What are these functions for?

Update 1

Got some response here.


Solution

  • With neko_vm_set_custom you can attach a custom variable (a context for example) of a user defined kind to your Neko virtual machine.

    With neko_vm_custom you get that variable of that kind back.

    An example might be: you have one or more VMs running, which are connected to their databases. With neko_vm_set_custom you attach the database connection for specific VM and with neko_vm_custom you can get it back.