summaryrefslogtreecommitdiff
path: root/examples/dynamic_dispatch_table.lua
blob: c515621d2f5d60cd9b23a56da16531647b2ffd45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}

return get_length_table