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

Function restore_luadata

src/nhlua.c:1344–1363  ·  view source on GitHub ↗

restore nh_lua_variables table from file */

Source from the content-addressed store, hash-verified

1342
1343/* restore nh_lua_variables table from file */
1344void
1345restore_luadata(NHFILE *nhfp)
1346{
1347 unsigned lua_data_len = 0;
1348#ifndef SFCTOOL
1349 char *lua_data;
1350#endif /* !SFCTOOL */
1351
1352 Sfi_unsigned(nhfp, &lua_data_len, "luadata-lua_data_len");
1353 lua_data = (char *) alloc(lua_data_len);
1354 Sfi_char(nhfp, lua_data, "luadata", lua_data_len);
1355
1356#ifndef SFCTOOL
1357 if (!gl.luacore)
1358 l_nhcore_init();
1359 luaL_loadstring(gl.luacore, lua_data);
1360 free(lua_data);
1361 nhl_pcall_handle(gl.luacore, 0, 0, "restore_luadata", NHLpa_panic);
1362#endif /* !SFCTOOL */
1363}
1364
1365#ifndef SFCTOOL
1366

Callers 1

restgamestateFunction · 0.85

Calls 3

l_nhcore_initFunction · 0.85
nhl_pcall_handleFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected