saving things

Q&A's, tips, howto's
Locked
tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

saving things

Post 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!

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post 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)

Locked