Pages: 1
Author Topic: Game End Return Value  (32,358 Views)
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Posted on: April 06, 2014, 04:51:37 AM
Just curious, why did game_end() never get a parameter? In most programming languages, ie. Java has System.Exit(return);

We should overload it to accept variant or some shit for ENIGMA.
Offline (Unknown gender) The 11th plague of Egypt

Member
Joined: Dec 2009
Posts: 274
View profile
Reply #1 Posted on: April 14, 2014, 12:00:30 PM
Good idea.
Does it also return something?
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #2 Posted on: April 14, 2014, 02:32:38 PM
It returns the first argument of the next run of the game, which starts at that call.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #3 Posted on: April 14, 2014, 07:11:55 PM
What Rusky? That doesn't make much sense.
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #4 Posted on: April 15, 2014, 04:25:58 AM
It makes more sense than asking for a return value from System.Quit
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #5 Posted on: April 15, 2014, 04:34:18 AM
Troll. Anyway, I went ahead and overloaded it per Josh's instructions with an int parameter type for all platforms.

Documentation for the function is here.
http://enigma-dev.org/docs/Wiki/Game_end
This was the commit.
https://github.com/RobertBColton/enigma-dev/commit/5484cbdb1f4fab04618c128cbb4b407bb5a45b22
Offline (Unknown gender) Rusky

Resident Troll
Joined: Feb 2008
Posts: 954
View profile WWW
Reply #6 Posted on: April 15, 2014, 01:51:27 PM
printf("%d\n", game_end(5))

$ ./game
$ echo $?
5

$ ./game 42
42
Pages: 1