When you click the "source code" words, it will take you to Löve's graphics.lua source code (In fact I believe right to the place where it defines them) that defines lua's global shader variables, and their GLSL equivalents next to them. Along with the ones that you just linked.rmcode wrote:Is this the reference you mean? Or is there another one?Zilarrezko wrote: Yeah, there's no mention of it in the source code
But there's a reference if you want to know the other stuff.
"Questions that don't deserve their own thread" thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: "Questions that don't deserve their own thread" thread
Re: "Questions that don't deserve their own thread" thread
So I got this class in my game. If I try to require the lua file that contains the class,it returns a nil value.
Here's the class I'm talking about.
Here's the class I'm talking about.
Re: "Questions that don't deserve their own thread" thread
<snip> Apparently I was wrong. See post below.ELFUERTE wrote:So I got this class in my game. If I try to require the lua file that contains the class,it returns a nil value.
Here's the class I'm talking about.
Last edited by rmcode on Fri Sep 12, 2014 3:26 pm, edited 1 time in total.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: "Questions that don't deserve their own thread" thread
So do you define Boy somewhere? The problem is probably that line 10 and 11 need to be in a function that is called at the start of the map.ELFUERTE wrote:So I got this class in my game. If I try to require the lua file that contains the class,it returns a nil value.
Here's the class I'm talking about.
Also, please upload the whole .love if you want a better answer than this.
EDIT: rmcode, you're wrong. They both work and in fact the notation with the dot instead of the slash is the canonical way.
Help us help you: attach a .love.
Re: "Questions that don't deserve their own thread" thread
Thanks for clearing that up - edited my previous post.Robin wrote:ELFUERTE wrote: EDIT: rmcode, you're wrong. They both work and in fact the notation with the dot instead of the slash is the canonical way.
I come from a modding background where Lua didn't work like it does with Löve (require didn't return the module for example). I'm now trying to learn "proper" Lua.
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: "Questions that don't deserve their own thread" thread
Alright man, so I got the map to pop up. After 24 hours up straight doing other coding my minds a bit bogged down, so I'm just going to give straight up answers rather than explaining them too much.ELFUERTE wrote:Here's the love file.
first, The variable scope is wrong.
Code: Select all
function love.load()
local level = {require "DesertExample"} --carica tutti i livelli
local num = 0 -- Mappa in cui siamo
global={}
global.tX = 0 --Variabili di traslazione
global.tY = 0
end
second, How you reference the index of the array level doesn't work in Lua. You must be from any other language in existence that uses base 0 for it's first index. Lua starts it's index's at 1, so changing num from 0 to 1 will fix that.
here's your code...
- Attachments
-
- BOXSTI_Fix.zip
- Have fun, don't do drugs, and all that crud.
- (93.21 KiB) Downloaded 116 times
Re: "Questions that don't deserve their own thread" thread
Thanks a lot man. I have no idea why i made that mistake with the index. So sorry. You're great tho. Good luck with your project !Zilarrezko wrote:Alright man, so I got the map to pop up. After 24 hours up straight doing other coding my minds a bit bogged down, so I'm just going to give straight up answers rather than explaining them too much.ELFUERTE wrote:Here's the love file.
first, The variable scope is wrong.
when you say "local", the variable/array is only visible in that function. So love.draw and love.keypressed. Just any function other than love.load can't see the "level" array, or the "num" variableCode: Select all
function love.load() local level = {require "DesertExample"} --carica tutti i livelli local num = 0 -- Mappa in cui siamo global={} global.tX = 0 --Variabili di traslazione global.tY = 0 end
second, How you reference the index of the array level doesn't work in Lua. You must be from any other language in existence that uses base 0 for it's first index. Lua starts it's index's at 1, so changing num from 0 to 1 will fix that.
here's your code...
Re: "Questions that don't deserve their own thread" thread
Quick question. I have the following folders.
-editor
->main.lua
-game
->tilemap.lua
I need to make a require(tilemap) from that main.lua file, but I'm not sure how since they are in different folders. Any help would be appreciated. Thanks!
-editor
->main.lua
-game
->tilemap.lua
I need to make a require(tilemap) from that main.lua file, but I'm not sure how since they are in different folders. Any help would be appreciated. Thanks!
- Cryogenical
- Prole
- Posts: 49
- Joined: Mon Apr 28, 2014 5:23 pm
Re: "Questions that don't deserve their own thread" thread
In your main, typemegalukes wrote:Quick question. I have the following folders.
-editor
->main.lua
-game
->tilemap.lua
I need to make a require(tilemap) from that main.lua file, but I'm not sure how since they are in different folders. Any help would be appreciated. Thanks!
Code: Select all
require "game/tilemap"
Who is online
Users browsing this forum: Bing [Bot] and 9 guests