From b7d4f302dc4398b3a10906ae73e3ecc8c74a14cf Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 2 May 2017 11:20:21 +0200 Subject: os.clock --- src/loslib.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/loslib.js b/src/loslib.js index 4c3331d..98686c4 100644 --- a/src/loslib.js +++ b/src/loslib.js @@ -80,7 +80,7 @@ const syslib = { }; // Only with Node -if (process && process.exit && process.env) { +if (process && process.exit && process.env && process.uptime) { const os_exit = function(L) { let status; if (lua.lua_isboolean(L, 1)) @@ -98,6 +98,12 @@ if (process && process.exit && process.env) { return 1; }; + const os_clock = function(L) { + lua.lua_pushnumber(L, process.uptime()); + return 1; + }; + + syslib.clock = os_clock; syslib.exit = os_exit; syslib.getenv = os_getenv; } -- cgit v1.2.3-70-g09d2