Code: Select all
(block (func1 funcLiteral func1Again)
(setq func1 (lambda Nil (dbgOutput "test")))
(objSetData gPlayerShip 'func func1)
;; now retrieve it as a literal
(setq funcLiteral (objGetData gPlayerShip 'func))
;; now, to convert it, we do some evalling
(setq func1Again (eval (eval funcLiteral)))
(func1Again)
)
(func1Again) happily outputs "test" to the console.
Now, func1Again is not the same object as func1, so stuff like closures are not preserved, but otherwise it feels and acts the same.
All in all, good news for dynamic modding