Search found 9 matches
- 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.
- 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] =...
- 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
I just do this:
Code: Select all
for i = 1, #f do
print(f[i], type(f[i]))
end
Edit:
Even something as basic as:
Code: Select all
print(#f)
- 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:
The f variable is empty? Am I misunderstanding the behavior of the getMode method?
Consider the following line:
Code: Select all
local w, h, f = love.window.getMode()
- Tue Jan 14, 2025 3:49 pm
- Forum: Support and Development
- Topic: [SOLVED] Snake clone help
- Replies: 2
- Views: 607
Re: Snake clone help
Thank you very much!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})
- 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.
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.
- 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
Yeah I know that, I just assumed that 'self' would be automatically returned, like in Python
- 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...
- 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...