Jump to content

Lua script Nil value?


slickman130
 Share

Recommended Posts

i am VERY NEW to programming and i hoped i wouldnt have to do much until i learned but my luck ran out and now i have to fix something in the script.

when i press play it brings me to the script and a box shows up and says GetPosition (Nil value)

First of all what does NilValue mean? second how do i fix that?

it says its on line 45 so this is what is on line 45

local targetpos = self.target:GetPosition(true)

if anyone can help me fix that i would be greatly appreciative.

Thanks in advance!

 

 

-Nate

Link to comment
Share on other sites

I offer a 1 on 1 Lua for Leadwerks training. The link to schedule one is in my sig below. $10 and hour and I go through this kind of stuff. It's meant for beginners or programmers new to Lua and want a quick lesson to catch up fast.

Link to comment
Share on other sites

About this specific issue I'm sure what's happening is that your self.target variable is empty and not pointing to anything. So it's trying to call the function GetPosition() on a 'nil' object (self.target) which it can't do.

Link to comment
Share on other sites

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
Reply to this topic...

×   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.

 Share

×
×
  • Create New...