From 4d8bd2b823eddada773a84e4004c380cf7de8762 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 3 Dec 2017 23:46:15 +1100 Subject: src/loslib.js: Add os.clock implementation for browsers --- src/loslib.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/loslib.js b/src/loslib.js index 4d549b6..4b147cf 100644 --- a/src/loslib.js +++ b/src/loslib.js @@ -157,8 +157,13 @@ const syslib = { "time": os_time }; -// Only with Node -if (!WEB) { +if (WEB) { + syslib.clock = function(L) { + lua.lua_pushnumber(L, performance.now()/1000); + return 1; + }; +} else { + /* Only with Node */ const fs = require('fs'); const tmp = require('tmp'); const child_process = require('child_process'); -- cgit v1.2.3-70-g09d2