Difference between revisions of "LSL Style Guide"
Althaea Xeno (talk | contribs) m (edit for clarity and style) |
|||
Line 1: | Line 1: | ||
Effective programming in LSL requires developers use a disciplined practice for applying formatting and convention to their scripts. | Effective programming in LSL requires that developers use a disciplined practice for applying formatting and convention to their scripts. | ||
These guidelines, referred to as a Style Guide, are not as rigid | These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write. | ||
==General Guidelines== | ==General Guidelines== | ||
Line 10: | Line 10: | ||
==Script Structure== | ==Script Structure== | ||
LSL scripts are comprised of expressions, functions, statements, event handlers and states. A well formatted LSL script follows this structure | LSL scripts are comprised of expressions, functions, statements, event handlers and states. A well formatted LSL script follows this structure: | ||
script variables | script variables |
Revision as of 12:55, 17 February 2007
Effective programming in LSL requires that developers use a disciplined practice for applying formatting and convention to their scripts.
These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.
General Guidelines
Naming Conventions
Script Structure
LSL scripts are comprised of expressions, functions, statements, event handlers and states. A well formatted LSL script follows this structure:
script variables
user defined functions
states, beginning with default, then listed alphabetically
within states, event handlers, in this order
on_rez state_entry
touches / collisions touch, touch_start, touch_end, collision, collision_start, collision_end, land_collision, land_collision_start, land_collision_end
communications listen, link_message, dataserver, email, remote_data, http_response, no_sensor, sensor, run_time_permissions, control
inventory changed, object_rez, money, attach
movement moving_end, moving_start, at_rot_target, at_target, not_at_rot_target, not_at_target
other
timer, state_exit