Helper function for garbage collection.
| 2961 | |
| 2962 | // Helper function for garbage collection. |
| 2963 | static 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) |
nothing calls this directly
no test coverage detected