Move _LUSH_VERSION global into luaopen_base alongside _VERSION
This commit is contained in:
@@ -540,6 +540,7 @@ static const luaL_Reg base_funcs[] = {
|
|||||||
/* placeholders */
|
/* placeholders */
|
||||||
{LUA_GNAME, NULL},
|
{LUA_GNAME, NULL},
|
||||||
{"_VERSION", NULL},
|
{"_VERSION", NULL},
|
||||||
|
{"_LUSH_VERSION", NULL},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -554,6 +555,9 @@ LUAMOD_API int luaopen_base (lua_State *L) {
|
|||||||
/* set global _VERSION */
|
/* set global _VERSION */
|
||||||
lua_pushliteral(L, LUA_VERSION);
|
lua_pushliteral(L, LUA_VERSION);
|
||||||
lua_setfield(L, -2, "_VERSION");
|
lua_setfield(L, -2, "_VERSION");
|
||||||
|
/* set global _LUSH_VERSION */
|
||||||
|
lua_pushliteral(L, LUSH_VERSION);
|
||||||
|
lua_setfield(L, -2, "_LUSH_VERSION");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
lua.c
2
lua.c
@@ -834,8 +834,6 @@ static int pmain (lua_State *L) {
|
|||||||
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
|
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
|
||||||
}
|
}
|
||||||
luai_openlibs(L); /* open standard libraries */
|
luai_openlibs(L); /* open standard libraries */
|
||||||
lua_pushstring(L, LUSH_VERSION);
|
|
||||||
lua_setglobal(L, "_LUSH_VERSION");
|
|
||||||
createargtable(L, argv, argc, script); /* create table 'arg' */
|
createargtable(L, argv, argc, script); /* create table 'arg' */
|
||||||
lua_gc(L, LUA_GCRESTART); /* start GC... */
|
lua_gc(L, LUA_GCRESTART); /* start GC... */
|
||||||
lua_gc(L, LUA_GCGEN); /* ...in generational mode */
|
lua_gc(L, LUA_GCGEN); /* ...in generational mode */
|
||||||
|
|||||||
Reference in New Issue
Block a user