-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlua_getupvalue.3
45 lines (45 loc) · 1.21 KB
/
lua_getupvalue.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.Dd $Mdocdate: July 13 2022 $
.Dt LUA_GETUPVALUE 3
.Os
.Sh NAME
.Nm lua_getupvalue
.Nd gets information about a closure's upvalue, function indicator
.Bo -0, + Pq 0|1 ,
-
.Bc
.Sh SYNOPSIS
.In lua.h
.Ft const char *
.Fn lua_getupvalue "lua_State *L" "int funcindex" "int n"
.Sh DESCRIPTION
.Fn lua_getupvalue
gets information about a closure's upvalue.
(For Lua functions, upvalues are the external local variables that the function
uses, and that are consequently included in its closure.)
.Fn lua_getupvalue
gets the index
.Fa n
of an upvalue, pushes the upvalue's value onto the stack, and returns its name.
.Fa funcindex
points to the closure in the stack.
(Upvalues have no particular order, as they are active through the whole
function.
So, they are numbered in an arbitrary order.)
.Sh RETURN VALUES
Returns
.Dv NULL
.Pq and pushes nothing
when the index is greater than the number of upvalues.
For C functions, this function uses the empty string "" as a name for all
upvalues.
.Sh SEE ALSO
.Rs
.%A Roberto Ierusalimschy
.%A Luiz Henrique de Figueiredo
.%A Waldemar Celes
.%T Lua 5.1 Reference Manual
.Re
.Sh HISTORY
The
.Fn lua_getupvalue
manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.