MCPcopy Create free account
hub / github.com/defold/defold / Buffer_len

Function Buffer_len

engine/gamesys/src/gamesys/scripts/script_buffer.cpp:788–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786 }
787
788 static int Buffer_len(lua_State *L)
789 {
790 DM_LUA_STACK_CHECK(L, 1);
791 dmBuffer::HBuffer hbuffer = dmScript::CheckBufferUnpack(L, 1);
792 uint32_t count = 0;
793 dmBuffer::Result r = dmBuffer::GetCount(hbuffer, &count);
794 if (r != dmBuffer::RESULT_OK) {
795 return DM_LUA_ERROR("%s.%s could not get buffer length", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_BUFFER);
796 }
797
798 lua_pushnumber(L, count);
799 return 1;
800 }
801
802 static const luaL_reg Buffer_methods[] =
803 {

Callers

nothing calls this directly

Calls 3

CheckBufferUnpackFunction · 0.85
GetCountFunction · 0.85
lua_pushnumberFunction · 0.85

Tested by

no test coverage detected