MCPcopy Create free account
hub / github.com/TASEmulators/fceux / savestate_gc

Function savestate_gc

src/lua-engine.cpp:2963–2984  ·  view source on GitHub ↗

Helper function for garbage collection.

Source from the content-addressed store, hash-verified

2961
2962// Helper function for garbage collection.
2963static int savestate_gc(lua_State *L) {
2964
2965 LuaSaveState *ss = (LuaSaveState *)lua_touserdata(L, 1);
2966 if(ss->persisted && ss->anonymous)
2967 remove(ss->filename.c_str());
2968 ss->~LuaSaveState();
2969
2970 //// The object we're collecting is on top of the stack
2971 //lua_getmetatable(L,1);
2972 //
2973 //// Get the filename
2974 //const char *filename;
2975 //lua_getfield(L, -1, "filename");
2976 //filename = lua_tostring(L,-1);
2977
2978 //// Delete the file
2979 //remove(filename);
2980 //
2981
2982 // We exit, and the garbage collector takes care of the rest.
2983 return 0;
2984}
2985
2986// Referenced by:
2987// savestate.create(var which = nil)

Callers

nothing calls this directly

Calls 2

lua_touserdataFunction · 0.85
~LuaSaveStateMethod · 0.80

Tested by

no test coverage detected