diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-05-30 15:39:01 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-05-30 15:39:38 +0300 |
commit | f2f3ed08db9709fbb0f4c48c0d9e39c450207383 (patch) | |
tree | ed19aa9aa0b2424d4fcb027c065871c1922ff45a /indra/newview/scripts | |
parent | 83d91c82f42f6c024e7e4dc6d6a64b067ad6117a (diff) | |
parent | 316bc0bdf30514a0c6894ef7c2859e79bf02a546 (diff) |
Merge branch release/luau-scripting
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r-- | indra/newview/scripts/lua/LLChat.lua | 17 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_LLChat.lua | 18 |
2 files changed, 35 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/LLChat.lua b/indra/newview/scripts/lua/LLChat.lua new file mode 100644 index 0000000000..7db538e837 --- /dev/null +++ b/indra/newview/scripts/lua/LLChat.lua @@ -0,0 +1,17 @@ +leap = require 'leap' + +local LLChat = {} + +function LLChat.sendNearby(msg) + leap.send('LLChatBar', {op='sendChat', message=msg}) +end + +function LLChat.sendWhisper(msg) + leap.send('LLChatBar', {op='sendChat', type='whisper', message=msg}) +end + +function LLChat.sendShout(msg) + leap.send('LLChatBar', {op='sendChat', type='shout', message=msg}) +end + +return LLChat diff --git a/indra/newview/scripts/lua/test_LLChat.lua b/indra/newview/scripts/lua/test_LLChat.lua new file mode 100644 index 0000000000..3abaf28e42 --- /dev/null +++ b/indra/newview/scripts/lua/test_LLChat.lua @@ -0,0 +1,18 @@ +LLChat = require 'LLChat' + +function generateRandomWord(length) + local alphabet = "abcdefghijklmnopqrstuvwxyz" + local wordTable = {} + for i = 1, length do + local randomIndex = math.random(1, #alphabet) + table.insert(wordTable, alphabet:sub(randomIndex, randomIndex)) + end + return table.concat(wordTable) +end + +local msg = {'AI says:'} +math.randomseed(os.time()) +for i = 1, math.random(1, 10) do + table.insert(msg, generateRandomWord(math.random(1, 8))) +end +LLChat.sendNearby(table.concat(msg, ' ')) |