Unable to recognize command "ROUND-DECIMAL". This error can occur when the command is not supported

Why do I get this unable to recognize command now and then? What am I doing wrong?? I like loading the LISP code by cut and paste into the command console btw. That's how I've been doing it. Any insight would be appreciated...

THE OUTPUT ERROR COMMAND CONSOLE
Unable to recognize command "ROUND-DECIMAL". This error can occur when the command is not supported for the active license.

HERE'S THE CODE THAT WAS LOADED:
(defun round-decimal (string precision)
(if (and (setq number (atof string))
(>= precision 0))
(vl-princ-to-string (vl-round number precision))
nil
)
)

Comments

  • You will need to specify the function name with the "C:" prefix, to be understood as a "command" :smile:

    > (defun c:round-decimal ...

    many greetings !
  • You will need to specify the function name with the "C:" prefix, to be understood as a "command" :smile:

    > (defun c:round-decimal ...

    many greetings !

    TY TY. That makes sense! fixed everything
  • Why not (rtos number precision)
  • wait, adding C: makes it a command, but you don't do that for functions that take a parameters, two in this case, (normally).
    That code is a "utility" function meant to be used in another lisp function.
    Expecting it to be used like a command makes no sense.
    thx
  • Could use it in some situations but a lot to type eg when asked for Text (round-decimal 123.45677 2)