From a33e24914b83b9f5be7a41ef583b37e73671c982 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Sat, 30 May 2020 10:07:17 +0300 Subject: [PATCH] [celx] Add method celestia:version() --- src/celscript/lua/celx_celestia.cpp | 8 ++++++++ test/scripts/version.celx | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/celscript/lua/celx_celestia.cpp b/src/celscript/lua/celx_celestia.cpp index 05db7021b..8f10dc68e 100644 --- a/src/celscript/lua/celx_celestia.cpp +++ b/src/celscript/lua/celx_celestia.cpp @@ -2132,6 +2132,12 @@ static int celestia_loadfragment(lua_State* l) return 1; } +static int celestia_version(lua_State* l) +{ + lua_pushstring(l, "1.7.0"); + return 1; +} + void CreateCelestiaMetaTable(lua_State* l) { Celx_CreateClassMetatable(l, Celx_Celestia); @@ -2236,6 +2242,8 @@ void CreateCelestiaMetaTable(lua_State* l) Celx_RegisterMethod(l, "loadfragment", celestia_loadfragment); + Celx_RegisterMethod(l, "version", celestia_version); + lua_pop(l, 1); } diff --git a/test/scripts/version.celx b/test/scripts/version.celx index 1574019e1..75360d853 100644 --- a/test/scripts/version.celx +++ b/test/scripts/version.celx @@ -1,3 +1,9 @@ print(_VERSION) print(_RELEASE) print(_LUAJIT_VERSION) + +if type(celestia['version']) == 'function' then + print(celestia:version()) +else + print("No celestia:version defined") +end