diff options
| author | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-30 02:57:50 -0700 |
|---|---|---|
| committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-30 02:57:50 -0700 |
| commit | 6165f2cda31a0ad5330360d2edd7cb480ef52179 (patch) | |
| tree | 6e9fb79fa8f765605b997f802ed22f83fad44215 /lualibs-os.lua | |
| parent | 202f064c65283e482f149868437e2881a73ebe3d (diff) | |
| parent | 01fd63f17c80e81218b3d65f1455a62c411dc6ff (diff) | |
| download | lualibs-6165f2cda31a0ad5330360d2edd7cb480ef52179.tar.gz | |
Merge pull request #3 from phi-gamma/master
sync with context
Diffstat (limited to 'lualibs-os.lua')
| -rw-r--r-- | lualibs-os.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lualibs-os.lua b/lualibs-os.lua index 42f3e48..05ca0ac 100644 --- a/lualibs-os.lua +++ b/lualibs-os.lua @@ -452,8 +452,20 @@ function os.now() return date("!%Y-%m-%d %H:%M:%S") -- 2011-12-04 14:59:12 end -if not os.sleep and socket then - os.sleep = socket.sleep +-- if not os.sleep and socket then +-- os.sleep = socket.sleep +-- end + +if not os.sleep then + local socket = socket + function os.sleep(n) + if not socket then + -- so we delay ... if os.sleep is really needed then one should also + -- be sure that socket can be found + socket = require("socket") + end + socket.sleep(n) + end end -- print(os.which("inkscape.exe")) |
