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

Function lua_pushsvt

ogsr_engine/xrGame/script_vars_storage.cpp:561–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561int lua_pushsvt(lua_State* L, CScriptVarsTable* T)
562{
563 SCRIPT_VAR* sv = (SCRIPT_VAR*)lua_newuserdata(L, sizeof(SCRIPT_VAR));
564 sv->type = LUA_TTABLE;
565 sv->size = 4;
566 sv->T = T;
567 T->add_ref(); // регистрация выдачи экземпляра в lua
568 int value_index = lua_gettop(L);
569 luaL_getmetatable(L, "GMT_SCRIPT_VARS");
570 int mt = lua_gettop(L);
571 if (!lua_istable(L, -1))
572 {
573 lua_pop(L, 1);
574 luaL_newmetatable(L, "GMT_SCRIPT_VARS");
575 register_method(L, "__gc", mt, script_vars_release);
576 register_method(L, "__len", mt, script_vars_size);
577 register_method(L, "__call", mt, script_vars_dump);
578 register_method(L, "__index", mt, script_vars_index);
579 register_method(L, "__newindex", mt, script_vars_new_index);
580 lua_pushvalue(L, mt);
581 lua_setfield(L, mt, "__metatable");
582 }
583 lua_setmetatable(L, value_index);
584 return 1;
585}
586
587int script_vars_create(lua_State* L) // создание таблицы переменных и опциональное заполнение из второго аргумента
588{

Callers 4

getMethod · 0.85
script_vars_createFunction · 0.85
script_vars_importFunction · 0.85
get_stored_varsFunction · 0.85

Calls 8

register_methodFunction · 0.85
add_refMethod · 0.80
lua_newuserdataFunction · 0.50
lua_gettopFunction · 0.50
luaL_newmetatableFunction · 0.50
lua_pushvalueFunction · 0.50
lua_setfieldFunction · 0.50
lua_setmetatableFunction · 0.50

Tested by

no test coverage detected