diff options
Diffstat (limited to 'TODO')
-rw-r--r-- | TODO | 170 |
1 files changed, 168 insertions, 2 deletions
@@ -1,12 +1,178 @@ | |||
1 | FIXES - | 1 | FIXES - |
2 | 2 | ||
3 | Use Lua consistently | ||
4 | ------------------------ | ||
5 | |||
6 | I noticed that the internal messages seem to be mostly LSL, but really | ||
7 | should be Lua at this early stage. LSL should be kept strictly inside | ||
8 | the LSL scripts. This might get tricky. Also, massage these notes into | ||
9 | docs later. | ||
10 | |||
11 | LuaSL Script server in C. | ||
12 | Opens a socket for script commands. | ||
13 | Accepts "compile(...)", "run(...)", and "exit()", | ||
14 | "run(...)" | ||
15 | Creates a script via scriptAdd(), with send2server included. | ||
16 | Either runs it directly, or stuffs it into the worker thread queue. | ||
17 | otherwise send2script(SID, command) | ||
18 | NOTE: treats "return ..." different to "function(...)". | ||
19 | |||
20 | send2script C function that adds the message to the scripts messages, then runs the script worker thread. | ||
21 | Runnr.c | ||
22 | send2server() C function that either directly runs certain LSL functions, or - | ||
23 | LuaSL_main.c | ||
24 | takeScript(me); | ||
25 | send2(me->client, me->SID, message); | ||
26 | releaseScript(me); | ||
27 | |||
28 | Runnr.c | ||
29 | worker thread | ||
30 | Starts or resumes the script running. If there's a message, push it as an argument. | ||
31 | Expects the script to eventually call Runnr.receive(). | ||
32 | Runnr.receive() | ||
33 | Does a Lua yeild, which will return once there is a message for this script. | ||
34 | Runnr.send() | ||
35 | Either send2script(SID, message), or send2server(message) | ||
36 | |||
37 | lib/LSL.lua Lua script that supplies all the LSL functions, and the basic LSL script support. | ||
38 | LSL.Lua runs the main loop of each LSL script. | ||
39 | waitAndProcess(false, "LSL.mainLoop") | ||
40 | LSL.lua assumes that it gets Lua messages from Runnr.receive(), and tries to run them via loadstring() and pcall(). | ||
41 | "start()" while paused is handled special, and likely should stay that way. | ||
42 | Sets the environment to that of LSL.lua, unless it's an event, before calling pcall. | ||
43 | Says it runs the return, but also sends the return via Runnr.send(nil, result1), which is commented out. | ||
44 | Sooo, doesn't do anything with the result, unless returnWanted. | ||
45 | Returns whatever the pcall returns, if returWanted, which we don't during the main loop. | ||
46 | Some of the ll functions are defined as a wrapper around waitAndProcess, that first Runnr.send(nil, ...) the function call details. | ||
47 | Which is currently the LSL version of the name, with LSL arguments. | ||
48 | NOTE: the wrappers don't currently deal with casting arguments, but should, and it has enough info to do so. | ||
49 | |||
50 | love.c World server in C. | ||
51 | Runs / connects to LuaSL server. | ||
52 | Sends "compile(...)" commands for each script it finds. | ||
53 | Accepts "compilerError/Warning(...)", "compiled(...)" | ||
54 | Once "compiled(...)", sends "run(...)" commands for them. | ||
55 | otherwise, a whole bunch of LSL functions, mostly faked, some simply sent to the client. | ||
56 | otherwise just log it as INFO. | ||
57 | Opens a socket for client stuff. | ||
58 | For each new client - | ||
59 | send2(client, "loadSim(...)" | ||
60 | Accepts "events.touch_start()", and "events.listen()" | ||
61 | passing them onto LuaSL, though with some extra info if it's a touch - | ||
62 | send2(ourGlobals->serverLuaSL, me->SID, "events.detectedKeys({\"%s\"})", ownerKey); | ||
63 | send2(ourGlobals->serverLuaSL, me->SID, "events.detectedNames({\"%s\"})", ownerName); | ||
64 | send2(ourGlobals->serverLuaSL, me->SID, "events.touch_start(1)"); | ||
65 | otherwise complains with a WARNING. | ||
66 | At some point - | ||
67 | send2(LuaSL, SID, "return ...") | ||
68 | send2(LuaSL, SID, "events.*(...)") | ||
69 | send2(LuaSL, ownerKey, "exit()") | ||
70 | |||
71 | extantz.c Client in C and lua. | ||
72 | Runs / connects to love server. | ||
73 | Accepts a bunch of LSL functions, "loadSim(...)", | ||
74 | llSay() and friends, llDialog() | ||
75 | otherwise log as INFO. | ||
76 | At some point - | ||
77 | send2(love, SID, "events.touch_start(1)") | ||
78 | send2(love, SID, "events.listen(...)") | ||
79 | |||
80 | |||
81 | What should happen (though leaving the Nailer step for much later, so use Lua instead of Nails ) - | ||
82 | LuaSL | ||
83 | converts LSL into Lua | ||
84 | runs everything in the Lua domain | ||
85 | sends Lua to the LuaNailer | ||
86 | deal with LSL -> Lua argument casting | ||
87 | accepts Lua from the LuaNailer | ||
88 | deal with Lua -> LSL return value casting | ||
89 | LuaNailer | ||
90 | converts Lua <-> Nails | ||
91 | love | ||
92 | accepts Nails commands from LuaNailer | ||
93 | sends some of them onto extantz | ||
94 | sends some back in response | ||
95 | relays / modifies Nails commands from extantz to LuaSL | ||
96 | extantz | ||
97 | accepts Nails commands from love | ||
98 | sends Nails commands to love | ||
99 | |||
100 | What does this internal Lua look like? | ||
101 | The internal Lua should be more SledjHamr flavour than LSL flavour, so we get a chance to design it right. | ||
102 | What's right though? | ||
103 | |||
104 | Handled by extantz - | ||
105 | For all of these, we need to know who / what sent it, and when, | ||
106 | also where the sender was at the time for some of these. | ||
107 | llSay(integer channel, string text)+ | ||
108 | also | ||
109 | llOwnerSay(string text) | ||
110 | llRegionSayTo(key target, integer channelID, string text) | ||
111 | Actually, if this sends messages to objects, then love should handle it, | ||
112 | only handled here if it's for a person. | ||
113 | llInstantMessage(string user, string message) | ||
114 | llDialog(key avatar, string caption, list arseBackwardsMenu, integer channel) | ||
115 | llListen(integer channel, string name, key id, string msg) | ||
116 | Sent from extantz - | ||
117 | events.listen(integer channel, string name, key id, string message) | ||
118 | events.touch_start(integer num_detected) | ||
119 | Handled by love - | ||
120 | object information get | ||
121 | avatar info get | ||
122 | llRequestPermissions() | ||
123 | position and rotation get | ||
124 | alpha get | ||
125 | inventory and link details get | ||
126 | free memory get | ||
127 | "notecard" get | ||
128 | Sent from love - | ||
129 | events.detected*({"",}) | ||
130 | events.*(...) | ||
131 | return ... | ||
132 | Handled by the script server - | ||
133 | time stuff get / set | ||
134 | script state get / set | ||
135 | |||
136 | Communication | ||
137 | say(key source, vector location, integer timestamp, text message, string filter, ...) | ||
138 | Source is the key of the avatar / object / script saying things. | ||
139 | Location is the location of that source in world at the time of the timestamp. | ||
140 | Though in the case of IMs, avatar might not be in world at the time. | ||
141 | filter is a comma separated string - | ||
142 | "<Xm>,<key>,<channel>" | ||
143 | llSay()+ include <channel>, and a distance restriction <Xm> in meters. | ||
144 | The distance restriction is one of a fixed four in LL - whisper, say, shout, region. | ||
145 | What these mean depends on how an OpenSim region is configured, or the default SL values. | ||
146 | So stuff in the SL values in LuaSL, convert to OS values in love, calculate objects / avatars within that radius in love, then pass it onto the objects scripts, or the avatar's client. | ||
147 | "Region" is the default, in other words, no distance restriction. | ||
148 | <key> would be a persons ID for llOwnerSay() and llInstantMessage(), but object/person ID for llRegionSayTo() | ||
149 | <channel> would be a channel name / number. LSL only has numbers, with two being fixed function. We can relax that and add strings. | ||
150 | NOTE: llRegionSayTo() includes both <key> and <channel>. | ||
151 | llDialog() includes a string and a list, er I mean table, Lua table. | ||
152 | |||
153 | Objects that are interested in things said register listeners with love, and get events.listen()'s sent to them. | ||
154 | Some sort of filter is needed for this as well. | ||
155 | listen(string filter, string text, integer flags) | ||
156 | filter - <Xm>,<key>,<channel> | ||
157 | In this case, <Xm> isn't actually needed by any LSL function, but I include it for completeness sake. | ||
158 | text - a string to match, might be a regex | ||
159 | flags - include the regex flags from the OS version | ||
160 | The last two arguments are optional. Flags is itself optional if text is there, defaulting to "not a regex". | ||
161 | returns a <handle> | ||
162 | can be in/actived, or removed. | ||
163 | This includes llDialog() and llTextBox(). | ||
164 | Note that these two are LL specific things, we use skang for the more general case. Though both need client side support, which means love has to pass these things around. | ||
165 | |||
166 | Link messages include the number of the link (to or from, depending on which end you are at), a number, a string, and a key. | ||
167 | These are entirely internal to LuaSL though. | ||
168 | |||
3 | LuaSL crashes | 169 | LuaSL crashes |
4 | ------------- | 170 | ----------------- |
5 | 171 | ||
6 | Hmmm, empty functions get no end, that's NOT legal in Lua. | 172 | Hmmm, empty functions get no end, that's NOT legal in Lua. |
7 | 173 | ||
8 | Project paths | 174 | Project paths |
9 | ------------- | 175 | ----------------- |
10 | 176 | ||
11 | The executables currently live in ...../SledjHamr. | 177 | The executables currently live in ...../SledjHamr. |
12 | Test executables stay in the src directory. | 178 | Test executables stay in the src directory. |