Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
xX_Pokeman2003_Xx

Need help on redefining an object

Question

I'm a tad rusty, so I need some help on this. My code roughly looks something like this.

function specload(file)
   if (spec==16) then return -1 end
   local spehand=0
   local specdata=0
   checkArg(1, drv, "string")
   local tmp="/special/" .. file
   if (filesystem.exists(tmp)==true) then
    spechand=filesystem.open(tmp)
    tmp=""
    repeat
     specdata=filesystem.read(spechand, math.huge)
     tmp = tmp .. (specdata or "")
    until not specdata
    read = load(tmp)
    read()
    tmp=0
    if not special.type then
      while true do
       if(spec[tmp]==0) then
          spec[tmp]=special
          special=nil
         else
          tmp=tmp+1
        end
       end
     end
   end
 end

The goal is to load a special type of file into memory and then assign all of its data to an object in an array known as spec[]. Everything that WILL get reassigned to that. The problem is that for whatever reason, I'm not getting my object identification code working. special.type refers to what type of file it is, and is defined in my file, but it is throwing an exception saying that special is a nil value. Special = {type = 0} and a function under special does exist though, so I have no idea what it's on about. From this, can you figure out what's wrong, or do I need to bring in more data?

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.