/src/

span> // Add action table to main table } return 1; } // rollback_revert_actions_by(actor, seconds) -> bool, log messages int ModApiRollback::l_rollback_revert_actions_by(lua_State *L) { MAP_LOCK_REQUIRED; std::string actor = luaL_checkstring(L, 1); int seconds = luaL_checknumber(L, 2); Server *server = getServer(L); IRollbackManager *rollback = server->getRollbackManager(); // If rollback is disabled, tell it's not a success. if (rollback == NULL) { lua_pushboolean(L, false); lua_newtable(L); return 2; } std::list<RollbackAction> actions = rollback->getRevertActions(actor, seconds); std::list<std::string> log; bool success = server->rollbackRevertActions(actions, &log); // Push boolean result lua_pushboolean(L, success); lua_createtable(L, log.size(), 0); unsigned long i = 0; for(std::list<std::string>::const_iterator iter = log.begin(); iter != log.end(); ++i, ++iter) { lua_pushnumber(L, i); lua_pushstring(L, iter->c_str()); lua_settable(L, -3); } return 2; } void ModApiRollback::Initialize(lua_State *L, int top) { API_FCT(rollback_get_node_actions); API_FCT(rollback_revert_actions_by); }