Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:scripting_portal:builtins [2018/10/23 04:33] (current)
Royale Mobian created
Line 1: Line 1:
 +====== YEngine builtins ======
  
 +===== Some built-in functions not described elsewhere =====
 +
 +==== C#-style argument substring functions: ==== 
 +<code ossl>
 +   ​string xmrSubstring (string s, integer offset)
 +   ​string xmrSubstring (string s, integer offset, integer length)
 +</​code>​
 +==== Java-style argument substring function: ==== 
 +<code ossl>
 +   ​string xmrJSubstring (string s, integer beg, integer end)
 +</​code>​
 +==== C#-style string searches: ==== 
 +<code ossl>
 +   ​integer xmrStringIndexOf (string haystack, string needle)
 +   ​integer xmrStringIndexOf (string haystack, string needle, integer startat)
 +   ​integer xmrLastStringIndexOf (string haystack, string needle)
 +   ​integer xmrLastStringIndexOf (string haystack, string needle, integer startat)
 +   ​integer xmrStringStartsWith (string haystack, string needle)
 +   ​integer xmrStringEndsWith (string haystack, string needle)
 +</​code>​
 +These functions convert strings to the given type but unlike standard LSL policy of return something even if wrong, they will throw an exception on conversion error:
 +<code ossl>
 +   float xmrString2Float (string s)
 +   ​integer xmrString2Integer (string s)
 +   ​rotation xmrString2Rotation (string s)
 +   ​vector xmrString2Vector (string s)
 +</​code>​
 + These functions convert values to strings with a C#-style formatting argument. Use ""​ to take the C# default.
 +<code ossl>
 +   ​string xmrFloat2String (float val, string fmt)
 +   ​string xmrInteger2String (integer val, string fmt)
 +   ​string xmrRotation2String (rotation val, string fmt)
 +   ​string xmrVector2String (vector val, string fmt)
 +</​code>​
 + Seat an avatar on a prim:
 +<code ossl>
 +   ​integer xmrSeatAvatar (integer owner)
 +     ​parameter:​
 +       owner = 0 : seat avatar that has granted this script PERMISSION_TRIGGER_ANIMATION
 +               1 : seat avatar that owns the prim this script is in
 +     ​returns:​
 +        0 : successful
 +       -1 : PERMISSION_TRIGGER_ANIMATION not granted
 +       -2 : no permissions requested by script
 +       -3 : avatar not present in region
 +</​code>​
 +==== 36-character UUID string to/from Base64 string (provides a 22-char representation of a UUID): ==== 
 +<code ossl>
 +   ​string xmrUUIDToBase64 (string uuidashexandhyphens)
 +     ​parameter:​
 +       ​uuidashexandhypends = 36-char UUID as hex digits and hyphens
 +     ​returns:​
 +       ​22-char UUID as base64
 +</​code>​
 +<code ossl>
 +   ​string xmrBase64ToUUID (string uuidasbase64)
 +     ​parameter:​
 +       ​uuidasbase64 = 22-char UUID as returned by xmrUUIDToBase64()
 +     ​returns:​
 +       ​36-char UUID as hex digits and hyphens
 +</​code>​
QR Code
QR Code wiki:scripting_portal:builtins (generated for current page)