Skip to content

Commit ea39042

Browse files
committed
Removed redundancy in definitions of version/release
String rendering now derived from the numeric original definitions.
1 parent 05ec55f commit ea39042

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

lua.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
** $Id: lua.h $
33
** Lua - A Scripting Language
4-
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
4+
** Lua.org, PUC-Rio, Brazil (www.lua.org)
55
** See Copyright Notice at the end of this file
66
*/
77

@@ -13,20 +13,19 @@
1313
#include <stddef.h>
1414

1515

16-
#include "luaconf.h"
16+
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2023 Lua.org, PUC-Rio"
17+
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
1718

1819

19-
#define LUA_VERSION_MAJOR "5"
20-
#define LUA_VERSION_MINOR "4"
21-
#define LUA_VERSION_RELEASE "6"
20+
#define LUA_VERSION_MAJOR_N 5
21+
#define LUA_VERSION_MINOR_N 4
22+
#define LUA_VERSION_RELEASE_N 6
2223

23-
#define LUA_VERSION_NUM 504
24-
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6)
24+
#define LUA_VERSION_NUM (LUA_VERSION_MAJOR_N * 100 + LUA_VERSION_MINOR_N)
25+
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + LUA_VERSION_RELEASE_N)
2526

26-
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
27-
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
28-
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2023 Lua.org, PUC-Rio"
29-
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
27+
28+
#include "luaconf.h"
3029

3130

3231
/* mark for precompiled code ('<esc>Lua') */
@@ -496,6 +495,17 @@ struct lua_Debug {
496495
/* }====================================================================== */
497496

498497

498+
#define LUAI_TOSTRAUX(x) #x
499+
#define LUAI_TOSTR(x) LUAI_TOSTRAUX(x)
500+
501+
#define LUA_VERSION_MAJOR LUAI_TOSTR(LUA_VERSION_MAJOR_N)
502+
#define LUA_VERSION_MINOR LUAI_TOSTR(LUA_VERSION_MINOR_N)
503+
#define LUA_VERSION_RELEASE LUAI_TOSTR(LUA_VERSION_RELEASE_N)
504+
505+
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
506+
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
507+
508+
499509
/******************************************************************************
500510
* Copyright (C) 1994-2023 Lua.org, PUC-Rio.
501511
*

0 commit comments

Comments
 (0)