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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! `LuaClosure` — the function variant of `LuaValue`. Three sub-kinds:
//! Lua closure (compiled Proto + upvalues), C closure (function pointer +
//! upvalues), light C function (function pointer, no upvalues).
use Cell;
use crateGcRef;
use crateLuaProto;
use crateUpVal;
use crateLuaValue;
/// Opaque registry index into `GlobalState.c_functions`, where the real
/// `lua_CFunction` (`fn(&mut LuaState) -> Result<usize, LuaError>`) is stored.
/// Lua-types can't reference `LuaState` without a circular dep, so we keep
/// the closure variant type-erased here and resolve through the registry at
/// call time.
pub type LuaCFnPtr = usize;
// ──────────────────────────────────────────────────────────────────────────────
// PORT STATUS
// source: src/lobject.h (CClosure / LClosure / Closure union)
// target_crate: lua-types
// confidence: high
// todos: 0
// port_notes: 0
// unsafe_blocks: 0
// notes: LuaClosure enum covering the C-Lua C/LightC/Lua closure variants.
// C uses a union with a common header; we use a tagged enum.
// LuaLClosure.upvals uses Cell<GcRef<UpVal>> (not RefCell) so per-
// upvalue reads avoid borrow-tracking; GcRef<UpVal> is Copy.
// ──────────────────────────────────────────────────────────────────────────────