Add 'listto' to fndata.txt; remove more magic names from the code

Rather than using a hardcoded table of list-to-type extraction function, add a 'ListTo' attribute to the function data. No error is raised if more than one function exists to convert to the same type.

This change is of questionable usefulness, but it should soothe those allergic to magic names/numbers. I cringed a bit myself.

While on it, change the syntax error that was raised when the corresponding conversion function did not exist, to a tailor-made error.
This commit is contained in:
Sei Lisa 2018-12-22 15:44:14 +01:00
parent a052bf499c
commit 0855b8ad1d
3 changed files with 70 additions and 45 deletions

View file

@ -75,6 +75,10 @@
# max:
# Like min, but for the maximum value.
#
# listto:
# Identifies the function as a list-extracting function, for use with
# lazy lists. It needs an LSL type as a parameter.
#
# return <value> [if <condition>]:
# Self-explanatory. There can be several; they are evaluated in order.
# <value> can be a parameter or a LSL constant. <condition> is explaned
@ -927,30 +931,37 @@ string llList2CSV(list src)
float llList2Float(list src, integer index)
- SEF
- listto float
integer llList2Integer(list src, integer index)
- SEF
- listto integer
string llList2Json(string type, list values)
- SEF
key llList2Key(list src, integer index)
- SEF
- listto key
list llList2List(list src, integer start, integer end)
- SEF
- listto list
list llList2ListStrided(list src, integer start, integer end, integer stride)
- SEF
rotation llList2Rot(list src, integer index)
- SEF
- listto rotation
string llList2String(list src, integer index)
- SEF
- listto string
vector llList2Vector(list src, integer index)
- SEF
- listto vector
integer llListFindList(list src, list test)
- SEF