I'd like to avoid situations like that so I thought about editing the string before loading it from:
1
2
3
4
5
6
7
2
3
4
5
6
7
for i = 1, 100000000 do 	for i = 1, 100000000 do 		for i = 1, 100000000 do 			print "foo" 		end 	end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local _time = os.time() for i = 1, 100000000 do 	if os.time() - _time >= 5 then 		break 	end 	for i = 1, 100000000 do 		if os.time() - _time >= 5 then 			break 		end 		for i = 1, 100000000 do 			if os.time() - _time >= 5 then 				break 			end 			print "foo" 		end 	end end
So, the main part - request. Provide me a function that will return an edited string that won't contain any code like in example no.1. It has to be like in the example no. 2. Code of a returned string have to abort all loops if the script takes more than 5 seconds to execute. Do not forget about other loops (while).
Or maybe users like Starkkz have some other ideas how to deal with stuff like that?