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 excluded = {["<para>"]=true, | |
["<eod>"]=true} | |
local function get_second_column(line, separator) | |
local start_pos, end_pos = line:find(separator, 1, true) | |
if not start_pos then error("unable to find separator") end | |
local sub_pos = end_pos + 1 | |
start_pos, end_pos = line:find(separator, sub_pos, true) | |
if not start_pos then error("unable to find separator") 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 excluded = {["<para>"]=true, | |
["<eod>"]=true} | |
local function write_table(data, fname) | |
local file = io.open(fname, "w") | |
io.output(file) | |
io.write(table.concat(data, " ")) | |
io.close(file) | |
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 excluded = {["<para>"]=true, | |
["<eod>"]=true} | |
local function write_table(data, fname) | |
local file = io.open(fname, "w") | |
io.output(file) | |
io.write(table.concat(data, " ")) | |
io.close(file) | |
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
function write_table(data, fname) | |
local file = io.open(fname, "w") | |
io.output(file) | |
io.write(table.concat(data, " ")) | |
io.close(file) | |
end | |
local function split_string(self, separator, max) | |
local tbl = {} | |
local current_pos = 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 function split(self, separator, plain_search) | |
if plain_search == nil then | |
plain_search = true | |
end | |
local tbl = {} | |
local current_pos = 1 | |
for i = 1, #self do | |
local start_pos, end_pos = self:find(separator, current_pos, plain_search) |
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 split_line(self, separator, plain_search) | |
if plain_search == nil then | |
plain_search = true | |
end | |
local tbl = {} | |
local current_pos = 1 | |
for i = 1, #self do | |
local start_pos, end_pos = self:find(separator, current_pos, plain_search) |
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 tests = { | |
aligned_float = [[ | |
struct __attribute__(( aligned(16) )) NAME { | |
__attribute__(( packed )) | |
float x, y, z; | |
}; | |
]], | |
aligned_double = [[ |
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
-- binary expressions | |
-- operator precedence | |
do -- BitWise tutorial https://www.youtube.com/watch?v=L4P98pGhpnE | |
local tokens, token, i | |
local function next_token() | |
i = i + 1 | |
token = tokens:sub(i, i) |
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 a = a+i < b/2+1 | |
local b = 5+x^2*8 | |
local a = (1+2)+(3+4) | |
local a = a+i < b/2+1 | |
local b = 5+x^2*8 | |
local a =a < y and y <= z | |
local a =-x^2 | |
local a =x^y^z | |
local a = 5+x^2*8 |
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
void scanBlocks(IntVector2 origin, List<LetterBlock> foundBlocks, List<LetterBlock> solved) | |
{ | |
if (foundBlocks.Count > 20) // crash safe for now | |
return; | |
LetterBlock block = getBlocks()[origin.x, origin.y] as LetterBlock; | |
if (!block || !block.inWord || solved.Contains(block)) | |
return; |