Jump to content




pcall: bad argument #1: value expected?


  • You cannot reply to this topic
6 replies to this topic

#1 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 14 May 2013 - 08:58 PM

When ever I try this code, it always errors with startup: 95: bad argument #1: value expected. It is weird, because I try/define everything and then when it gets to this pcall statement, it errors on me.

Installer (Beta)

pastebin get 2LVGRcKi install

PS: Debug prints is what I use to debug, don't hate me! XD

Edit: Oh ya, the code.

https://github.com/M...ob/beta/startup

#2 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 15 May 2013 - 12:41 AM

I think you didn't declare the "func" function.

#3 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 15 May 2013 - 02:01 AM

View PostMackan90096, on 15 May 2013 - 12:41 AM, said:

I think you didn't declare the "func" function.
loadstring returns a function, setfenv returns the function it edited (in this case the loadstring return). I think the issue is that the loadstring is returning nil. Please check that the http.get function is getting the right information and if you loadstring it make sure it returns a function

#4 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 15 May 2013 - 08:44 AM

I print the type of the func function, it prints function.

And even if you put pcall(lolololololrotortlotlrtlorto) in the LUA prompt it doesn't say that, only when you put pcall().

Edit: Nevermind, fixed the problem.

#5 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 15 May 2013 - 09:38 AM

what was the problem? I be curious

#6 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 15 May 2013 - 05:53 PM

Apparently, in loadfile, if the file has a syntax error, it returns a function with no value? I don't think it actually works that way, or .OSRunner/Boot/startup had a weird problem on line 95. (But when I changed the line on the regular /startup, it also changed the line in the error to the line with that same code.)

I think that it was just a mistake on my part.

#7 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 15 May 2013 - 06:56 PM

heh. I just realized that it was not pcall that was causing that issue... it was setfenv lol, loadstring returned nil which caused setfenv to error before pcall even ran





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users