diff options
author | David Walter Seikel | 2012-02-05 21:00:09 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-05 21:00:09 +1000 |
commit | 5eeaaefdd428b5a962878d4b620a658aedccb127 (patch) | |
tree | 7abdcd975b8ed0c68c1af68f298d6dc29e7f31be /LuaSL | |
parent | Fake some ll*() functions. (diff) | |
download | SledjHamr-5eeaaefdd428b5a962878d4b620a658aedccb127.zip SledjHamr-5eeaaefdd428b5a962878d4b620a658aedccb127.tar.gz SledjHamr-5eeaaefdd428b5a962878d4b620a658aedccb127.tar.bz2 SledjHamr-5eeaaefdd428b5a962878d4b620a658aedccb127.tar.xz |
Implement llList2*(), llDeleteSubList(), and llGetListLength().
Diffstat (limited to 'LuaSL')
-rw-r--r-- | LuaSL/src/LSL.lua | 89 |
1 files changed, 71 insertions, 18 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index d0c97c4..12b3236 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -287,23 +287,6 @@ function --[[integer]] LSL.llSubStringIndex(--[[string]] text, --[[string]] sub | |||
287 | function --[[list]] LSL.llParseString2List(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; | 287 | function --[[list]] LSL.llParseString2List(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; |
288 | function --[[list]] LSL.llParseStringKeepNulls(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; | 288 | function --[[list]] LSL.llParseStringKeepNulls(--[[string]] In, --[[list]] l, --[[list]] l1) return {} end; |
289 | 289 | ||
290 | function --[[list]] LSL.llCSV2List(--[[string]] text) return {} end; | ||
291 | function --[[list]] LSL.llDeleteSubList(--[[list]] l,--[[integer]] start,--[[integer]] eNd) return {} end; | ||
292 | function --[[string]] LSL.llDumpList2String(--[[list]] l, --[[string]] separator) return "" end; | ||
293 | function --[[string]] LSL.llList2CSV(--[[list]] l) return "" end; | ||
294 | function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index) return 0.0 end; | ||
295 | function --[[integer]] LSL.llList2Integer(--[[list]] l,--[[integer]] index) return 0 end; | ||
296 | function --[[key]] LSL.llList2Key(--[[list]] l,--[[integer]] index) return LSL.NULL_KEY end; | ||
297 | function --[[list]] LSL.llList2List(--[[list]] l,--[[integer]] start,--[[integer]] eNd) return {} end; | ||
298 | function --[[string]] LSL.llList2String(--[[list]] l,--[[integer]] index) return "" end; | ||
299 | function --[[rotation]] LSL.llList2Rotation(--[[list]] l,--[[integer]] index) return LSL.ZERO_ROTATION end; | ||
300 | function --[[vector]] LSL.llList2Vector(--[[list]] l,--[[integer]] index) return LSL.ZERO_VECTOR end; | ||
301 | function --[[integer]] LSL.llListFindList(--[[list]] l, --[[list]] l1) return 0 end; | ||
302 | function --[[list]] LSL.llListInsertList(--[[list]] l, --[[list]] l1,--[[integer]] index) return {} end; | ||
303 | function --[[integer]] LSL.llGetListLength(--[[list]] l) return 0 end; | ||
304 | function --[[list]] LSL.llListReplaceList(--[[list]] l, --[[list]] part,--[[integer]] start,--[[integer]] eNd) return {} end; | ||
305 | function --[[list]] LSL.llListSort(--[[list]] l,--[[integer]] stride,--[[integer]] ascending) return {} end; | ||
306 | |||
307 | function --[[key]] LSL.llAvatarOnSitTarget() return LSL.NULL_KEY end; | 290 | function --[[key]] LSL.llAvatarOnSitTarget() return LSL.NULL_KEY end; |
308 | function --[[list]] LSL.llGetAnimationList(--[[key]] id) return {} end; | 291 | function --[[list]] LSL.llGetAnimationList(--[[key]] id) return {} end; |
309 | function --[[key]] LSL.llGetKey() return LSL.NULL_KEY end; | 292 | function --[[key]] LSL.llGetKey() return LSL.NULL_KEY end; |
@@ -326,6 +309,76 @@ function LSL.llWhisper(--[[integer]] channel, --[[string]] text) print("Channe | |||
326 | 309 | ||
327 | function LSL.llMessageLinked(--[[integer]] link,--[[integer]] num, --[[string]] text, --[[key]] aKey) end; | 310 | function LSL.llMessageLinked(--[[integer]] link,--[[integer]] num, --[[string]] text, --[[key]] aKey) end; |
328 | 311 | ||
312 | |||
313 | -- LSL list functions. | ||
314 | |||
315 | function --[[list]] LSL.llCSV2List(--[[string]] text) return {} end; | ||
316 | function --[[list]] LSL.llDeleteSubList(--[[list]] l,--[[integer]] start,--[[integer]] eNd) | ||
317 | local temp = {} | ||
318 | local x = 1 | ||
319 | |||
320 | -- Deal with the impedance mismatch. | ||
321 | start = start + 1 | ||
322 | eNd = eNd + 1 | ||
323 | for i = 1,#l do | ||
324 | if i < start then temp[x] = l[i]; x = x + 1 | ||
325 | elseif i > eNd then temp[x] = l[i]; x = x + 1 | ||
326 | end | ||
327 | end | ||
328 | |||
329 | return temp | ||
330 | end | ||
331 | |||
332 | function --[[string]] LSL.llDumpList2String(--[[list]] l, --[[string]] separator) return "" end; | ||
333 | function --[[string]] LSL.llList2CSV(--[[list]] l) return "" end; | ||
334 | function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index) | ||
335 | local temp = tonumber(l[index]) | ||
336 | if nil == temp then temp = 0.0 end | ||
337 | return temp; | ||
338 | end | ||
339 | |||
340 | function --[[integer]] LSL.llList2Integer(--[[list]] l,--[[integer]] index) | ||
341 | local temp = tonumber(l[index+1]) | ||
342 | if nil == temp then temp = 0 end | ||
343 | return temp; | ||
344 | end | ||
345 | |||
346 | function --[[key]] LSL.llList2Key(--[[list]] l,--[[integer]] index) | ||
347 | local temp = l[index+1] | ||
348 | if temp then return "" .. temp else return LSL.NULL_KEY end | ||
349 | end | ||
350 | |||
351 | function --[[list]] LSL.llList2List(--[[list]] l,--[[integer]] start,--[[integer]] eNd) return {} end; | ||
352 | function --[[string]] LSL.llList2String(--[[list]] l,--[[integer]] index) | ||
353 | local temp = l[index+1] | ||
354 | if temp then return "" .. temp else return "" end | ||
355 | end | ||
356 | |||
357 | function --[[rotation]] LSL.llList2Rotation(--[[list]] l,--[[integer]] index) | ||
358 | local temp = l[index+1] | ||
359 | if nil == temp then temp = LSL.ZERO_ROTATION end | ||
360 | -- TODO - check if it's not an actual rotation, then return LSS.ZERO_ROTATION | ||
361 | return temp; | ||
362 | end | ||
363 | |||
364 | function --[[vector]] LSL.llList2Vector(--[[list]] l,--[[integer]] index) | ||
365 | local temp = l[index+1] | ||
366 | if nil == temp then temp = LSL.ZERO_VECTOR end | ||
367 | -- TODO - check if it's not an actual rotation, then return LSS.ZERO_VECTOR | ||
368 | return temp; | ||
369 | end | ||
370 | |||
371 | function --[[integer]] LSL.llListFindList(--[[list]] l, --[[list]] l1) return 0 end; | ||
372 | function --[[list]] LSL.llListInsertList(--[[list]] l, --[[list]] l1,--[[integer]] index) return {} end; | ||
373 | function --[[integer]] LSL.llGetListLength(--[[list]] l) | ||
374 | return #l | ||
375 | end | ||
376 | |||
377 | function --[[list]] LSL.llListReplaceList(--[[list]] l, --[[list]] part,--[[integer]] start,--[[integer]] eNd) return {} end; | ||
378 | function --[[list]] LSL.llListSort(--[[list]] l,--[[integer]] stride,--[[integer]] ascending) return {} end; | ||
379 | |||
380 | |||
381 | |||
329 | -- Crements stuff. | 382 | -- Crements stuff. |
330 | 383 | ||
331 | function LSL.preDecrement(name) _G[name] = _G[name] - 1; return _G[name]; end; | 384 | function LSL.preDecrement(name) _G[name] = _G[name] - 1; return _G[name]; end; |
@@ -336,7 +389,7 @@ function LSL.postIncrement(name) local temp = _G[name]; _G[name] = _G[name] + 1; | |||
336 | -- State stuff | 389 | -- State stuff |
337 | 390 | ||
338 | local currentState = {} | 391 | local currentState = {} |
339 | local running = true; | 392 | local running = true |
340 | 393 | ||
341 | -- Stuff called from the wire protocol has to be global, but I think this means just global to this file. | 394 | -- Stuff called from the wire protocol has to be global, but I think this means just global to this file. |
342 | function quit() | 395 | function quit() |