Code: Select all
function love.update(dt)
if gui.Button({text = "Test",pos = {100, 100}}) then
self:remove()
end
end
Code: Select all
main.lua:26: Attempt to index global self(a nil value)
Code: Select all
function love.update(dt)
if gui.Button({text = "Test",pos = {100, 100}}) then
self:remove()
end
end
Code: Select all
main.lua:26: Attempt to index global self(a nil value)
Code: Select all
obj = {}
obj.remove = function(self)
assert(self == obj)
end
Code: Select all
obj = {}
function obj:remove()
assert(self == obj)
end
Code: Select all
obj.remove(obj)
Code: Select all
obj:remove()
Code: Select all
function obj:remove()
self = nil
end
Code: Select all
function obj.remove(self)
self = nil
end
Code: Select all
local tabletest = {}
obj.remove(tabletest)
Code: Select all
function love.update(dt)
if not buttonClicked then
if gui.Button({text = "Test",pos = {100, 100}}) then
buttonClicked = true
end
end
end
Code: Select all
local foo = {
x = 5,
}
function foo.bar( self )
if self then
print("In bar, self exists and self.x is " .. tostring(self.x))
else
print("In bar, self is nil")
end
end
function foo:czar()
if self then
print("In czar, self exists and self.x is " .. tostring(self.x))
else
print("In czar, self is nil")
end
end
foo.bar()
foo:bar()
foo.bar(foo)
foo.czar()
foo:czar()
foo.czar(foo)
Users browsing this forum: Bing [Bot] and 3 guests