luaur_vm/methods/temp_buffer_allocate.rs
1use crate::macros::lua_m_newarray::luaM_newarray;
2use crate::records::temp_buffer::TempBuffer;
3use crate::type_aliases::lua_state::lua_State;
4use luaur_common::macros::luau_assert::LUAU_ASSERT;
5
6impl<T> TempBuffer<T> {
7 pub unsafe fn allocate(&mut self, L: *mut lua_State, count: usize) {
8 LUAU_ASSERT!(self.L.is_null());
9 self.L = L;
10 self.data = luaM_newarray!(L, count, T, 0);
11 self.count = count;
12 }
13}