Page 1 of 1

saving things

Posted: Sun Aug 09, 2009 1:12 pm
by tom
Hey guys,

I have a list I want to either empty or add to depending on whether a checkbox is checked. How do I save so that the list state survives running the script? I can

(save "list.lsp" 'list)

but list.lsp gets rewritten every time I access the page. (I'm mangling newlisp wiki for a specific task)

how do I do that? Thanks!

Posted: Sun Aug 09, 2009 4:52 pm
by cormullion
It seems to work the way you'd expect. Load the list, change it, then save it.

Code: Select all

(set 'L '(1 2 3 4))
(save "save.lsp" 'L)

(dotimes (x 5)
    (load "save.lsp")
    (push x L -1)
    (save "save.lsp" 'L))
    
(println L)
and L is (1 2 3 4 0 1 2 3 4)