Nilly nil, nil, nil, yup, still nil.

A million free points (which are totally worthless except for bragging rights) to the first person who can correct my absolutely abysmal, gross incompetence.

Why does the first print(self.x) work, but the second returns nil?

This is the main tab:

-- temp3

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    buggy = Bug(777)

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    -- This sets the line thickness

    -- Do your drawing here

This is the bug tab:

Bug = class()

function Bug:init(x)
    -- you can accept and set parameters here
    self.x = x

function Bug:InitImages()

function Bug:draw()
    -- Codea does not automatically call this method

function Bug:touched(touch)
    -- Codea does not automatically call this method

MrScience101 - we’ve all done this too many times to count

self.InitImages() should have a colon

@MrScience101, you can do one of two things:

(1): self.InitImages(self)

(2): self:InitImages()

When you call self.InitImages, it is calling the function but not passing self meaning you are indeed accessing a nil variable.

EDIT: Ignatz beat me to it.

@Ignatz and @JakAttak I hereby award you both a million free points and the right to rub it in should we ever cross paths. I now am going to go bang my head against the wall while chanting “colon” as punishment for my crimes.

@MrScience101 - you will notice many dents in the wall from previous heads