MCPcopy Create free account
hub / github.com/NetHack/NetHack / save_luadata

Function save_luadata

src/nhlua.c:1327–1341  ·  view source on GitHub ↗

save nh_lua_variables table to file */

Source from the content-addressed store, hash-verified

1325
1326/* save nh_lua_variables table to file */
1327void
1328save_luadata(NHFILE *nhfp)
1329{
1330 unsigned lua_data_len;
1331#ifndef SFCTOOL
1332 char *lua_data = get_nh_lua_variables(); /* note: '\0' terminated */
1333#endif
1334
1335 if (!lua_data)
1336 lua_data = dupstr(emptystr);
1337 lua_data_len = Strlen(lua_data) + 1; /* +1: include the terminator */
1338 Sfo_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len");
1339 Sfo_char(nhfp, lua_data, "luadata", lua_data_len);
1340 free(lua_data);
1341}
1342
1343/* restore nh_lua_variables table from file */
1344void

Callers 1

savegamestateFunction · 0.85

Calls 2

get_nh_lua_variablesFunction · 0.85
dupstrFunction · 0.85

Tested by

no test coverage detected