From b9411ebac8c2bb84db94f758b9c960d64519c5ce Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Feb 2016 08:24:01 +0100 Subject: [PATCH] ADD: added a simple sleep function. Thanks to Mosci --- client/lualibs/utils.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/lualibs/utils.lua b/client/lualibs/utils.lua index 399c30ed..bf62fc88 100644 --- a/client/lualibs/utils.lua +++ b/client/lualibs/utils.lua @@ -82,8 +82,8 @@ local Utils = return nil end, - ------------ CRC-16 ccitt checksums - -- Takes a hex string and calculates a crc16 + ------------ CRC-8 Legic checksums + -- Takes a hex string and calculates a crc8 Crc8Legic = function(s) if s == nil then return nil end if #s == 0 then return nil end @@ -301,6 +301,15 @@ local Utils = return n end, + -- a simple implementation of a sleep command. Thanks to Mosci + -- takes number of seconds to sleep + Sleep = function(n) + local clock = os.clock + local t0 = clock() + while clock() - t0 <= n do end + return nil + end, + -- function convertStringToBytes(str) -- local bytes = {} -- local strLength = string.len(str) -- 2.39.5