Talk:Read Note Card Configuration

From Second Life Wiki
Jump to navigation Jump to search

Observations

  1. if(llSubStringIndex(data, "#") != 0) <<== This involves a byte-by-byte search for '#', even if none exists. Better to examine the first byte only, but do a STRING_TRIM first
  2. notecardQueryId = llGetNotecardLine(configurationNotecardName, ++line); <<== this can be done earlier in the dataserver event, to gain time from background processing by the server
  3. string name = llGetSubString(data, 0, i - 1); <<== confusing choice of data name for this application, which is processing avatar names
  4. There's no point having a user defined function that is only called once. In fact both UDF's can easily be avoided, providing savings in script size.

Omei Qunhua 03:48, 17 December 2013 (PST)

  1. Agreed.
  2. Agreed.
  3. In other programming contexts they would be a key/value pair. But key is reserved in LSL. It could be better named or documented.
  4. Yes they can both be entirely avoided but they show the user which code is specific to the actual processing and initialization and which is just stuff necessary for running the script. It nicely divides the code into reasonable chunks. So I agree but it comes at the cost of readability.
This is in the Tutorials category, readability is more important than optimization. I too have trouble not optimizing it. That said, one way to both keep the readability and improve the article would be to discuss the shortcomings (that we don't fix) of the script and then show the corrected script. -- Strife (talk|contribs) 22:18, 17 December 2013 (PST)