-
Find the Discord channel in which you would like to send commits and other updates
-
In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!
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
| require 'sys' | |
| local n = 100000 | |
| local seq = {} | |
| for i = 1, n do seq[i] = i end | |
| local bs = 405 | |
| local plainLoop = function() | |
| local yield = {} | |
| for i = 1, #seq do |
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
| queue = {} | |
| queue_max = 100 | |
| producer = coroutine.create(function () | |
| while #queue < queue_max do | |
| local item = "Hello! "..#queue | |
| table.insert(queue, item) | |
| -- print(item .. " inserted") | |
| end |
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
| #!/usr/bin/env lua5.2 | |
| -- | |
| -- apt install lua5.2 lua-socket | |
| -- | |
| local socket = require("socket") | |
| local udp = assert(socket.udp()) | |
| local data | |
| udp:settimeout(1) |
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 ordered_table = {} | |
| --[[ | |
| This implementation of ordered table does not hold performance above functionality. | |
| It invokes a metamethod `__newindex` for every access, and | |
| while this is not ideal performance wise, the resulting table behaves very closely to | |
| a standard Lua table, with the quirk that the keys are ordered by when they are first seen | |
| (unless deleted and then reinserted.) | |
| --]] | |
| -- private unique keys |
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
| for idx = 1, 5 do repeat | |
| print(1) | |
| print(2) | |
| print(3) | |
| do break end -- goes to next iteration of for | |
| print(4) | |
| print(5) | |
| until true end |
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 function getOS() | |
| local raw_os_name, raw_arch_name = '', '' | |
| -- LuaJIT shortcut | |
| if jit and jit.os and jit.arch then | |
| raw_os_name = jit.os | |
| raw_arch_name = jit.arch | |
| else | |
| -- is popen supported? | |
| local popen_status, popen_result = pcall(io.popen, "") |
It seems the command-line toolchain of choice changes every fortnight on Windows (except if you're in the MSVC camp, but that's a no-go for ooc at the time of this writing).
The new kid on the block is msys2, which I first had doubts about, but it turns out it's a great way to get a shell, install the packages you need via pacman (!) and get started with ooc on windows.
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
| -- table library extensions | |
| if (dump == nil) then | |
| dump = function(t) | |
| print("=============") | |
| for k,v in pairs(t) do | |
| print("\t",k,v) | |
| end | |
| print("=============") | |
| end |

