I'm trying to use the function (eval ...). So far, I do not get it to work. Or at least, I cannot get it to do anything useful.
Maybe I'm indoctrinated in my expectation based on other languages, maybe the function is
Scenario:
I want the to run a string as code. The string is build from user input.
Example of what I would like to accomplish:
Code: Select all
(block (theInput)
(setq theInput "(objAddItem gPlayerShip (itmCreate 0x00104006 1))")
(printTo 'log (cat "eval result: " (eval theInput)))
)
- one &itDallSphere; added into the cargo hold of the player ship
- a line in the log file saying:
01/12/2015 21:12:21 eval result: True
- a line in the log file saying:
01/12/2015 21:12:21 eval result: No binding for symbol ["(objAddItem gPlayerShip (itmCreate 0x00104006 1))"] ### (eval theInput) ### - Pixelfck annoyed
So, what syntax lets (eval ...) evaluate a string as code?
~Pixelfck