Add lua mod
This commit is contained in:
		
							
								
								
									
										17
									
								
								chat_mod/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								chat_mod/init.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| function send_messages(res) | ||||
| 	for message in string.gmatch(res["data"], "[^\n]+") do | ||||
| 		minetest.chat_send_all(message) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function main(http_api) | ||||
| 	port = minetest.settings:get("chat_server_port") | ||||
| 	if port == nil then | ||||
| 		port = "9876" | ||||
| 	end | ||||
| 	http_api.fetch({url = "http://localhost:" .. port .. "/get"}, send_messages) | ||||
| 	minetest.after(0.5, main, http_api) | ||||
| end | ||||
|  | ||||
| local http_api = minetest.request_http_api() | ||||
| main(http_api) | ||||
		Reference in New Issue
	
	Block a user