Difference between revisions of "LlGetListEntryType"
Jump to navigation
Jump to search
Omei Qunhua (talk | contribs) (Fix 2 non-compilable scripts. Fix 3rd script that broke many style rules. Supply missing 'key' type list entry.) |
Omei Qunhua (talk | contribs) m (Tweak. (And earlier edit removed irrelevant 'tip')) |
||
Line 89: | Line 89: | ||
integer type = (integer)(value = llList2String(pair, len)); | integer type = (integer)(value = llList2String(pair, len)); | ||
value = llDeleteSubString(value, 0, llSubStringIndex(value, "=")); | value = llDeleteSubString(value, 0, llSubStringIndex(value, "=")); | ||
if ( | if (type == TYPE_INTEGER) | ||
replace = [(integer)value]; | replace = [(integer)value]; | ||
else if ( | else if (type == TYPE_FLOAT) | ||
replace = [(float)value]; | replace = [(float)value]; | ||
else if (type == TYPE_STRING ) | else if (type == TYPE_STRING ) |
Revision as of 08:05, 4 January 2013
{{LSL_Function |inject-2= |func_id=194|func_sleep=0.0|func_energy=10.0 |func=llGetListEntryType|return_type=integer |p1_type=list|p1_name=src |p2_type=integer|p2_name=index |func_footnote= |func_desc |return_text=that is the type of the entry index in src. |spec |caveats=
- If a vector is stored in a list as "<7,5,0>" (as a string type, as opposed to <7,5,0> which is a vector type), its type will be returned as TYPE_STRING, not TYPE_VECTOR. The same applies for "1" being returned as a string instead of an integer, etc. There is no easy way to guess what the type should be from a string value. The users intent may not be obvious
|constants=
Type | Description | |
---|---|---|
TYPE_INTEGER | 1 | integer |
TYPE_FLOAT | 2 | float |
TYPE_STRING | 3 | string |
TYPE_KEY | 4 | key |
TYPE_VECTOR | 5 | vector |
TYPE_ROTATION | 6 | rotation |
TYPE_INVALID | 0 | none |
|examples= <lsl> string get_list_entry_type_info(integer inputInteger) {
if (inputInteger == TYPE_INTEGER) return "integer"; else if (inputInteger == TYPE_FLOAT) return "float"; else if (inputInteger == TYPE_STRING) return "string"; else if (inputInteger == TYPE_KEY) return "key"; else if (inputInteger == TYPE_VECTOR) return "vector"; else if (inputInteger == TYPE_ROTATION) return "rotation";
// else
return "