## Some noob questions

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
NoAim91
Prole
Posts: 38
Joined: Mon Feb 20, 2017 10:28 am
Location: Germany

### Some noob questions

Hello, I try since several hours and i don´t get it, so i´m sorry for this simple questions but i can´t figure out how to do it.

1.) I have a function with some if statements, and at the last if statement i like to set a global variable from true to false. I know how to change is in the local, but how do i get the scope to global? (i have tryed return, but it doesn´t work)

2.) How to call a function? Sounds stupid, i know .. but at the end of the if statement it should say to a function "do your thing" without give any value input.

Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

### Re: Some noob questions

1) the same way you set a local variable, just without the local keyword
2) DoYourThing() (capitalization is entirely optional) - however you need to have the DoYourThing() function defined beforehand

NoAim91
Prole
Posts: 38
Joined: Mon Feb 20, 2017 10:28 am
Location: Germany

### Re: Some noob questions

thanks for the reply ... like every time my problem was something other. But I solved it.

But I have a new Question :-)

What GUI should i use? Should i write my own at the very beginning?

edit: is there any good GUI Tutorial für lua (and probebly löve?)

Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: Some noob questions

I recommend SUIT or Gööi, or if you dare, binary ones like imgui or nuklear
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)

NoAim91
Prole
Posts: 38
Joined: Mon Feb 20, 2017 10:28 am
Location: Germany

### Re: Some noob questions

Thank you SUIT looks fine :-)

another question ... when/why I use " : " in lua?

zorg
Party member
Posts: 3057
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

### Re: Some noob questions

You can use it wherever you want (it's just syntactic sugar); more importantly, here's the shortest way (for me) to show how it differs from dot notation:

Code: Select all

local t = {}
function t.f(a,b) return self,a,b end
function t:g(a,b) return self,a,b end
t.f(1,2) --> nil, 1, 2
t:f(1,2) --> nil, t, 1
t.g(1,2) --> 1, 2, nil
t:g(1,2) --> t, 1, 2

Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Positive07
Party member
Posts: 1006
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: Some noob questions

This

Code: Select all

local t = {}

function t.func (self, a, b, ...)
print(self) --Prints t
--Code
end


Is equivalent to this

Code: Select all

local t = {}

function t:func (a, b, ...)
print(self) --Prints t
--Code
end


And this

Code: Select all

t.func(t, 1, 2, 3)

Is equivalent to this

Code: Select all

t:func(1, 2, 3)

for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(Github.com/Positive07)

### Who is online

Users browsing this forum: No registered users and 76 guests