This file contains 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
#define KEY_POLL_TEST | |
struct termios poll_before, poll_new; | |
struct timeval poll_tv; | |
fd_set poll_fs; | |
int poll_init(){ | |
poll_tv.tv_usec = POLL_TIMEOUT_MICROSECONDS; | |
poll_tv.tv_sec = POLL_TIMEOUT_SECONDS; | |
if(tcgetattr(STDIN_FILENO, &poll_before) != 0) return 1; |
This file contains 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
cmake_minimum_required(VERSION 3.10) | |
include(ExternalProject) | |
ExternalProject_Add(lua | |
URL "https://www.lua.org/ftp/lua-5.3.5.tar.gz" | |
CONFIGURE_COMMAND "" | |
BUILD_COMMAND make generic | |
BUILD_ALWAYS true | |
BUILD_IN_SOURCE true | |
INSTALL_COMMAND "" |
This file contains 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
function fullcopy(a, b) | |
for k, v in pairs(a) do | |
if type(v)=="table" then | |
b[k] = {} | |
fullcopy(v, b[k]) | |
else | |
b[k] = v | |
end | |
end | |
end |
This file contains 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
MAX_SIZE = 4 | |
Ring = {} | |
function insert(ring, a) | |
table.insert(ring, a) | |
if #ring > MAX_SIZE then | |
table.remove(ring, 1) | |
end | |
end |