Hi,
I was wondering, I need my in-game balance to go negative at some times in my game.
How could I do this? I'd like to be able to have a balance of -1450 for example. And then earn some money and go positive, etc.
Any idea?
Thanks!
Negative integers?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- OmarShehata
- Party member
- Posts: 259
- Joined: Tue May 29, 2012 6:46 pm
- Location: Egypt
- Contact:
Re: Negative integers?
So...where's the problem?
Code: Select all
local balance = 10;
balance = balance - 100;
print(balance);
balance = balance + 200;
print(balance);
Re: Negative integers?
Frankly, I was sure lua wasn't going to do this. So sure that I didn't tested it.OmarShehata wrote:So...where's the problem?
Code: Select all
local balance = 10; balance = balance - 100; print(balance); balance = balance + 200; print(balance);
Thanks for this and sorry :-S
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Negative integers?
I'm really interested in what led you to that belief. Do you know why, or just have a good guess about it?tomshreds wrote:Frankly, I was sure lua wasn't going to do this.
Help us help you: attach a .love.
Re: Negative integers?
I think that every single programming language ever has supported negative numbers.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- YellowAfterlife
- Prole
- Posts: 29
- Joined: Mon Jan 23, 2012 4:05 pm
- Contact:
Re: Negative integers?
Some languages also support unsigned number types;T-Bone wrote:I think that every single programming language ever has supported negative numbers.
Some of RISC architectures may leave signed number implementation to programmer for various reasons.
yal.cc
Contains things I work on. Also gets Love2d examples time to time.
Contains things I work on. Also gets Love2d examples time to time.
Who is online
Users browsing this forum: Google [Bot] and 10 guests