Created
December 19, 2018 17:06
-
-
Save Hermitter/2fc71d879dfede1ad5cff8e341273dd1 to your computer and use it in GitHub Desktop.
simple code snippets to help me with nan.h in node.js addons.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grab array | |
v8::Local<v8::Array> jsArray = v8::Local<v8::Array>::Cast(info[0]); | |
// array length | |
int arraySize = jsArray->Length(); | |
// grab first array element & converto to proper type | |
int indexOne = jsArray->Get(0)->Int32Value(); | |
// return element | |
info.GetReturnValue().Set(indexOne); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment