Second Life objects are written in a language called Linden Scripting Language (LSL). For more on how to use this language, refer to this wiki http://wiki.secondlife.com/wiki/LSL_Portal.
A good tutorial on LSL can be found in this Dr Dobbs Journal article using the Linden Scripting Language.
The Second Life framework Drupal module interfaces with Second Life using the llHTTPRequest() function.
See details here for llHTTPRequest.
In order to write a Drupal application that interfaces with Second Life, you need to create a new module. See the sltest module in the samples directory for an example.
The app is the application name, and is also the module name. The cmd is a command that your module/app must handle. The args vary from one cmd to the other.
The $sl object contains the Second Life info you need to know, such as region, location in the grid, user name, user key, ...etc. The $args is an array that is passed from the LSL script to you.