MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / get_into

Function get_into

extlibs/sol3/include/sol/sol.hpp:11698–11715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11696
11697 template <typename BaseCh, typename S>
11698 inline S get_into(lua_State* L, int index, record& tracking) {
11699 using Ch = typename S::value_type;
11700 tracking.use(1);
11701 size_t len;
11702 auto utf8p = lua_tolstring(L, index, &len);
11703 if (len < 1)
11704 return S();
11705 const char* strb = utf8p;
11706 const char* stre = utf8p + len;
11707 stack_detail::count_code_units_utf<BaseCh> count_units;
11708 convert<BaseCh>(strb, stre, count_units);
11709 S r(count_units.needed_size, static_cast<Ch>(0));
11710 r.resize(count_units.needed_size);
11711 Ch* target = &r[0];
11712 stack_detail::copy_code_units_utf<Ch, BaseCh> copy_units(target);
11713 convert<BaseCh>(strb, stre, copy_units);
11714 return r;
11715 }
11716 } // namespace stack_detail
11717
11718 template <typename T, typename>

Callers

nothing calls this directly

Calls 3

lua_tolstringFunction · 0.85
resizeMethod · 0.80
useMethod · 0.45

Tested by

no test coverage detected