Jump to content




Picture Opener Error

computer lua

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

#1 Ziriee

  • Members
  • 47 posts

Posted 07 September 2013 - 02:16 PM

Guys, I got a bug that I can't figure out. Please anyone can find a solution?
Error message: picturer:77: bad argument #1: value expected
Code: http://pastebin.com/4r4pPsTY
Thanks in advance!

#2 Grim Reaper

  • Members
  • 503 posts
  • LocationSeattle, WA

Posted 07 September 2013 - 03:58 PM

You might be converting your hex numbers into decimal numbers incorrectly. Try using tonumber (hexNumber, 16) to convert the hex string into base 10 from base 16.

#3 Ziriee

  • Members
  • 47 posts

Posted 07 September 2013 - 04:14 PM

View PostGrim Reaper, on 07 September 2013 - 03:58 PM, said:

You might be converting your hex numbers into decimal numbers incorrectly. Try using tonumber (hexNumber, 16) to convert the hex string into base 10 from base 16.
It did fix the problem, but now there's a weird bracket bug that I can't trace.
Error: bios:337: [string "picturer"]:56: ')' expected
Link: http://pastebin.com/7Z6LXupD
Note: I am trying to edit a picture

#4 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 07 September 2013 - 07:17 PM

this line wasnt using parentheses properly
term.setBackgroundColor(2^tonumber(string.sub(bg[pi], pj, pj), 16))


#5 Ziriee

  • Members
  • 47 posts

Posted 08 September 2013 - 05:32 AM

View PostPixelToast, on 07 September 2013 - 07:17 PM, said:

this line wasnt using parentheses properly
term.setBackgroundColor(2^tonumber(string.sub(bg[pi], pj, pj), 16))
picturer:71: attempt to perform arithmetic __pow on number and nil

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 08 September 2013 - 05:57 AM

if tonumber is returning nil then it means the string being passed to it is not valid hexadecimal. Make sure you're not giving it anything that wouldn't be valid hex.

#7 Ziriee

  • Members
  • 47 posts

Posted 08 September 2013 - 06:04 AM

View Posttheoriginalbit, on 08 September 2013 - 05:57 AM, said:

if tonumber is returning nil then it means the string being passed to it is not valid hexadecimal. Make sure you're not giving it anything that wouldn't be valid hex.
Might be the problem, but it crashes when I try to change the BG color or text color in the editor. When I edit the numbers manually it shows the colors just fine.

#8 Ziriee

  • Members
  • 47 posts

Posted 09 September 2013 - 06:46 AM

FIXED. I switched the height with width, so I had '19' instead of '51'. Thanks for contributing everyone!





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users