MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SaveObject

Method SaveObject

src/script/api/script_list.cpp:333–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331
332
333bool ScriptList::SaveObject(HSQUIRRELVM vm)
334{
335 sq_pushstring(vm, "List");
336 sq_newarray(vm, 0);
337 sq_pushinteger(vm, this->sorter_type);
338 sq_arrayappend(vm, -2);
339 sq_pushbool(vm, this->sort_ascending ? SQTrue : SQFalse);
340 sq_arrayappend(vm, -2);
341 sq_newtable(vm);
342 for (const auto &item : this->items) {
343 sq_pushinteger(vm, item.first);
344 sq_pushinteger(vm, item.second);
345 sq_rawset(vm, -3);
346 }
347 sq_arrayappend(vm, -2);
348 return true;
349}
350
351bool ScriptList::LoadObject(HSQUIRRELVM vm)
352{

Callers

nothing calls this directly

Calls 7

sq_pushstringFunction · 0.85
sq_newarrayFunction · 0.85
sq_pushintegerFunction · 0.85
sq_arrayappendFunction · 0.85
sq_pushboolFunction · 0.85
sq_newtableFunction · 0.85
sq_rawsetFunction · 0.85

Tested by

no test coverage detected