src/nvim/lua/treesitter.c
/// push node interface on lua stack
///
/// top of stack must either be the tree this node belongs to or another node
/// of the same tree! This value is not popped. Can only be called inside a
/// cfunction with the tslua environment.
push node interface on lua stack
top of stack must either be the tree this node belongs to or another node
of the same tree. This value is not popped. Can only be called inside a
cfunction with the tslua environment.
push node interface on lua stack top of stack must either be the tree this node belongs to or another node of the same tree . This value is not popped . Can only be called inside a cfunction with the tslua environment .
static void push_node(lua_State *L, TSNode node, int uindex)
{
  assert(uindex > 0 || uindex < -LUA_MINSTACK);
  if (ts_node_is_null(node)) {
    lua_pushnil(L);  
    return;
  }
  TSNode *ud = lua_newuserdata(L, sizeof(TSNode));  
  *ud = node;
  lua_getfield(L, LUA_REGISTRYINDEX, "treesitter_node");  
  lua_setmetatable(L, -2);  
  lua_getfenv(L, uindex);  
  lua_setfenv(L, -2);  
}
static void push_node ( lua_State * L , TSNode node , int uindex ) { assert ( uindex > 0 || uindex < - LUA_MINSTACK ) ; if ( ts_node_is_null ( node ) ) { lua_pushnil ( L ) ; return ; } TSNode * ud = lua_newuserdata ( L , sizeof ( TSNode ) ) ; * ud = node ; lua_getfield ( L , LUA_REGISTRYINDEX , " " ) ; lua_setmetatable ( L , -2 ) ; lua_getfenv ( L , uindex ) ; lua_setfenv ( L , -2 ) ; }
push node interface on lua stack
top of stack must either be the tree this node belongs to or another node
of the same tree!
push node interface on lua stack top of stack must either be the tree this node belongs to or another node of the same tree!
// [nil] // [udata] // [udata, meta] // [udata] // [udata, reftable] // [udata]