Unary Operators
-
- Prole
- Posts: 3
- Joined: Wed Nov 02, 2016 4:42 pm
Unary Operators
Is there a list of Unary operators that is used in Love?
Re: Unary Operators
You are looking for Lua's unary operators, not LÖVEs, since LÖVE isn't a language.
The lua reference lists the minus, length operator (#) and "not":
https://www.lua.org/manual/5.1/manual.html#2.5
The lua reference lists the minus, length operator (#) and "not":
https://www.lua.org/manual/5.1/manual.html#2.5
-
- Prole
- Posts: 3
- Joined: Wed Nov 02, 2016 4:42 pm
Re: Unary Operators
Thanks for the feedback.
I did check the Lua docs first but I didn't know if Love had some modified stuff in it like Pico 8 does.
it is mainly because I am a touch lazy and I like the way I can do or over .
Stupidly I tried it first and got a great big fat error on compile lol. And I didn't want to think I missed something obvious.
I did check the Lua docs first but I didn't know if Love had some modified stuff in it like Pico 8 does.
it is mainly because I am a touch lazy and I like the way I can do
Code: Select all
a+=1
Code: Select all
a-=1
Code: Select all
a = a+1
Stupidly I tried it first and got a great big fat error on compile lol. And I didn't want to think I missed something obvious.
Re: Unary Operators
+= and -= aren't unary operators though, they are a special case of assignment operators (and Lua as used in Löve only has the assignment operator '=' (singular).sudo_radish wrote:Thanks for the feedback.
I did check the Lua docs first but I didn't know if Love had some modified stuff in it like Pico 8 does.
it is mainly because I am a touch lazy and I like the way I can doorCode: Select all
a+=1
overCode: Select all
a-=1
.Code: Select all
a = a+1
Stupidly I tried it first and got a great big fat error on compile lol. And I didn't want to think I missed something obvious.
Assignment operators look like infix operators but they actually aren't since
a) they don't form an expression / yield a value (can't do print(a = 3) is illegal)
b) the left hand side can't be any expression, it must be a variable (can't do 3 = 3)
Who is online
Users browsing this forum: Bing [Bot] and 1 guest