Author Topic: error: bad argument type: stringp nil  (Read 4082 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
error: bad argument type: stringp nil
« on: July 29, 2009, 10:22:16 AM »
i having a tough time figuring out why this error happens
i know its something really simple that im missing
maybe a fresh pair of eyes can spot it.

if the block "bmhead" isnt found, everything works as it should
if the block is found it works all the way till it needs to run the function jobfile, after it loads newtext-x
at that point i get the stringp nil

am i missing something?





Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: error: bad argument type: stringp nil
« Reply #1 on: July 29, 2009, 11:32:24 AM »
maybe .. it might also be good to see newtext-x.lsp as well

One thing I noticed is that you are relying on global variables from one function to be used in another function, for example, ordernum is set in write2file, at first you set it to an arbitrary value 'ff, presumably set in your vla-GetCustomByIndex function. If that fails, and ff is set to nil then you have some serious problems.

Since you don't know exactly where the function fails, and since it fails only if it loads newtext-x.lsp then I would have to conclude that is where the problem lies.

Perhaps your reliance on global variables has bitten you in the proverbial ass ... then again maybe not.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

andrew_nao

  • Guest
Re: error: bad argument type: stringp nil
« Reply #2 on: July 29, 2009, 11:39:23 AM »
got it figured out

i was using variables that were in the other function
and since that function didnt set those variables first is why the erros was happening

its fixed now

thanks for the tip keith

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: error: bad argument type: stringp nil
« Reply #3 on: July 29, 2009, 11:41:50 AM »
you are welcome

and on a lighter note, let this be a lesson for those who would use global variables ;)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: error: bad argument type: stringp nil
« Reply #4 on: July 29, 2009, 11:43:11 AM »
On this topic, I would strongly advise against global variables where possible - the prevent exactly this circumstance, in which programs "clash" which each other.

Either use local variables, sub-functions called with arguments, or sub-functions with lexical scoping.

Lee