Search found 9 matches

by DarkblooM
Sun Jan 19, 2025 3:56 pm
Forum: Support and Development
Topic: [SOLVED] Return value of love.window.getMode
Replies: 8
Views: 1544

Re: Return value of love.window.getMode

I'm not sure I understand it fully but at least I now know how to work around it.
by DarkblooM
Sun Jan 19, 2025 1:48 pm
Forum: Support and Development
Topic: [SOLVED] Return value of love.window.getMode
Replies: 8
Views: 1544

Re: Return value of love.window.getMode

What platform are you on? I see this when using print_r function that you can find around (http://lua-users.org/wiki/TableSerialization): [1] = 1920 [2] = 1080 [3]: [stencil] = true [depth] = 0 [x] = 0 [y] = 0 [minwidth] = 1 [minheight] = 1 [fullscreen] = true [fullscreentype] = desktop [display] =...
by DarkblooM
Sun Jan 19, 2025 11:08 am
Forum: Support and Development
Topic: [SOLVED] Return value of love.window.getMode
Replies: 8
Views: 1544

Re: Return value of love.window.getMode

slime wrote: Sun Jan 19, 2025 12:52 am Can you post the code that checks whether it's empty? I don't think that should be possible.
I just do this:

Code: Select all

for i = 1, #f do
  print(f[i], type(f[i]))
end
But nothing appears on the console.

Edit:
Even something as basic as:

Code: Select all

print(#f)
Just prints 0 to the console.
by DarkblooM
Sun Jan 19, 2025 12:37 am
Forum: Support and Development
Topic: [SOLVED] Return value of love.window.getMode
Replies: 8
Views: 1544

[SOLVED] Return value of love.window.getMode

Hello

Consider the following line:

Code: Select all

local w, h, f = love.window.getMode()
The f variable is empty? Am I misunderstanding the behavior of the getMode method?
by DarkblooM
Tue Jan 14, 2025 3:49 pm
Forum: Support and Development
Topic: [SOLVED] Snake clone help
Replies: 2
Views: 607

Re: Snake clone help

BrotSagtMist wrote: Tue Jan 14, 2025 3:26 pm You are not making copies of the position here.
You merely link it.
Ergo your path points to the real snake.
Try:
table.insert(snake.path, 1, {x=snake.pos.x,y=snake.pos.y})
Thank you very much!
by DarkblooM
Tue Jan 14, 2025 2:37 pm
Forum: Support and Development
Topic: [SOLVED] Snake clone help
Replies: 2
Views: 607

[SOLVED] Snake clone help

Hello

Trying to make a Snake clone, I can't seem to figure out why the snake's trail isn't displaying on screen.

Code: https://pastebin.com/i1fqFdBY

Enlightenment would be appreciated.
by DarkblooM
Sat Sep 21, 2024 9:42 am
Forum: Support and Development
Topic: [SOLVED] Error: attempt to index a nil value
Replies: 4
Views: 9948

Re: [SOLVED] Error: attempt to index a nil value

pgimeno wrote: Sat Sep 21, 2024 9:22 am You're welcome. Unrelated to classes, though, if you're using the return value of a function, that function needs to return something; otherwise you'll always get nil from it.
Yeah I know that, I just assumed that 'self' would be automatically returned, like in Python
by DarkblooM
Sat Sep 21, 2024 8:17 am
Forum: Support and Development
Topic: [SOLVED] Error: attempt to index a nil value
Replies: 4
Views: 9948

Re: Error: attempt to index a nil value

Hello, welcome to the forums. You're using the return value from Player.new() to set the variable `player`, yet you've forgetting to return a value within Player.new(). Simply add `return self` at the end of the function. Ah OK, I'm still not fully used to "classes" in Lua haha. Thanks fo...
by DarkblooM
Fri Sep 20, 2024 9:48 pm
Forum: Support and Development
Topic: [SOLVED] Error: attempt to index a nil value
Replies: 4
Views: 9948

[SOLVED] Error: attempt to index a nil value

Hello. I'm taking my first steps into using LÖVE and I'm running into an issue that I can't quite identify. Here's my main.lua: Player = { pos = {0, 0}, speed = 0 } function Player.new(pos, speed) local self = setmetatable({}, Player) self.pos = pos or {0, 0} self.speed = speed or 300 end function l...