diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-03 23:46:15 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-03 23:46:15 +1100 |
commit | 4d8bd2b823eddada773a84e4004c380cf7de8762 (patch) | |
tree | 3932d53f2396df3e2b0e54111c5a4a387ff1157e /src/loslib.js | |
parent | 2de7580fb1109c5342de0088c174eec634594c00 (diff) | |
download | fengari-4d8bd2b823eddada773a84e4004c380cf7de8762.tar.gz fengari-4d8bd2b823eddada773a84e4004c380cf7de8762.tar.bz2 fengari-4d8bd2b823eddada773a84e4004c380cf7de8762.zip |
src/loslib.js: Add os.clock implementation for browsers
Diffstat (limited to 'src/loslib.js')
-rw-r--r-- | src/loslib.js | 9 |
1 files 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'); |