From: Christophe Rhodes Date: Sun, 20 Apr 2014 19:43:31 +0000 (+0100) Subject: implement new slimefun swank:lookup-and-save-presented-object-or-lose X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=commitdiff_plain;h=55bb6badd1c00884315aa19df9c5319e18787265 implement new slimefun swank:lookup-and-save-presented-object-or-lose For better presentations --- diff --git a/swank-presentations.R b/swank-presentations.R index 6ac0e75..69488cf 100644 --- a/swank-presentations.R +++ b/swank-presentations.R @@ -4,6 +4,8 @@ savePresentedObject <- function(slimeConnection, value) { if(!exists("idToObject", envir=slimeConnection)) { assign("idToObject", new.env(), envir=slimeConnection) } + ## FIXME this should check for value already being present in the + ## idToObject map presentationCounter <<- presentationCounter + 1 assign(as.character(presentationCounter), value, envir=slimeConnection$idToObject) presentationCounter @@ -43,7 +45,12 @@ sendReplResultFunction <- presentReplResult stop(sprintf("attempt to access unrecorded object (id %d)", id)) } } - + +`swank:lookup-and-save-presented-object-or-lose` <- function(slimeConnection, sldbState, id) { + obj <- `swank:lookup-presented-object-or-lose`(slimeConnection, sldbState, id) + savePresentedObject(slimeConnection, obj) +} + `swank:clear-repl-results` <- function(slimeConnection, sldbState) { if(!exists("idToObject", envir=slimeConnection)) { assign("idToObject", new.env(), envir=slimeConnection)