MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / script_vars_import

Function script_vars_import

ogsr_engine/xrGame/script_vars_storage.cpp:616–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616int script_vars_import(lua_State* L) // загрузка таблицы переменных из нет-пакета
617{
618 CScriptVarsTable* svt = NULL;
619 if (lua_isuserdata(L, 1))
620 svt = lua_tosvt(L, 1);
621 if (!svt)
622 svt = xr_new<CScriptVarsTable>(); // здесь добавлять ссылку не надо, т.к. объект нигде не сохраняется!
623
624 if (lua_isstring(L, 1))
625 svt->set_name(lua_tostring(L, 1));
626
627 object_rep* rep = is_class_object(L, 2);
628 if (rep && strstr(rep->crep()->name(), "net_packet"))
629 {
630 NET_Packet* src = (NET_Packet*)rep->ptr();
631 void* from = &src->B.data[src->r_pos];
632 IReader reader(from, src->r_elapsed());
633 svt->load(reader);
634 }
635
636 return lua_pushsvt(L, svt);
637}
638
639int get_stored_vars(lua_State* L) { return lua_pushsvt(L, &g_ScriptVars); }
640

Callers

nothing calls this directly

Calls 9

lua_isuserdataFunction · 0.85
lua_tosvtFunction · 0.85
is_class_objectFunction · 0.85
lua_pushsvtFunction · 0.85
r_elapsedMethod · 0.80
lua_isstringFunction · 0.50
set_nameMethod · 0.45
nameMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected