Created
May 21, 2019 15:48
-
-
Save CapsAdmin/ffa464314b4c51dedbf7f4640b9b698e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local cast = ffi.cast | |
local ctype = ffi.typeof("float *") | |
local function get_num(bytes) | |
local res = cast(ctype, bytes)[0] | |
if not res then | |
print(res, type(res), res or 0) | |
res = 0 | |
end | |
return res | |
end | |
local num = 0 | |
while true do | |
local bytes = "\xFF\xFF\xFF" .. string.char(math.random(250, 255)) | |
local res = get_num(bytes) | |
print(num, res) | |
num = num + res | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment