local get_length_table = { [".."] = function(match) local bytes = string.byte(match, 1, 2) local length = bytes[1] * 256^2 + bytes[2] -- TODO byte order? local get_binary_data_table = { [string.rep(".", length)] = function(match) command_queue:enqueue(match) dispatch_table:register_handler_table(get_length_table) end } dispatch_table:register_handler_table(get_binary_data_table) end } local responses = { [".*\n"] = function(match) end } return get_length_table, responses