comparison src/lib/Chat.luan @ 83:a47036fd0158

group chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Mar 2025 13:56:59 -0600
parents bc9f452ee168
children
comparison
equal deleted inserted replaced
82:0bc5e0d098f7 83:a47036fd0158
63 function chat.http_push(message) 63 function chat.http_push(message)
64 local url = base_url().."/chat/"..chat.id 64 local url = base_url().."/chat/"..chat.id
65 Http.push(url,message) 65 Http.push(url,message)
66 end 66 end
67 67
68 function chat.other_user_id(my_id) 68 function chat.other_user_ids(my_id)
69 local t = {nil}
69 for _, user_id in ipairs(chat.user_ids) do 70 for _, user_id in ipairs(chat.user_ids) do
70 if user_id ~= my_id then 71 if user_id ~= my_id then
71 return user_id 72 t[#t+1] = user_id
72 end 73 end
73 end 74 end
74 error() 75 return t
75 end 76 end
76 77
77 local function get_chatuser_key(user) 78 local function get_chatuser_key(user)
78 return chat.id.."~"..user.id 79 return chat.id.."~"..user.id
79 end 80 end