luaur_repl_cli/functions/counters_track.rs
1use luaur_vm::functions::lua_ref::lua_ref;
2use luaur_vm::type_aliases::lua_state::lua_State;
3
4use crate::functions::counters_init::G_COUNTERS;
5
6// Faithful port of:
7// void countersTrack(lua_State* L, int funcindex) {
8// int ref = lua_ref(L, funcindex);
9// gCounters.moduleRefs.push_back(ref);
10// }
11pub fn counters_track(l: *mut lua_State, funcindex: i32) {
12 unsafe {
13 let ref_id = lua_ref(l, funcindex);
14 (*core::ptr::addr_of_mut!(G_COUNTERS))
15 .module_refs
16 .push(ref_id);
17 }
18}