[eluser]Josh Bright[/eluser]
Still, by not requiring the prefs to be passed to the constructor, and having a separate method to do that gets around this problem, if one needs to use an object/string/integer for whatever reason.
Code:
$prefs = new stdObject();
$prefs->name = "Test Pref";
$prefs->type = "normal";
$this->load->library("my_library");
$this->my_library->setPrefs($prefs);
If you need to send just an integer or string into a library, you may as well just wrap that in an array, or, use a setter in your library to set that one value. It just sort of seems like to me an unnecessary thing (dealing with handing data to a library in the load->library() method) to have to think about when dealing with libraries when you can just make your own setPrefs type method to handle the data (whatever type) however you want.
On a side note, in looking around in the Loader.php file (in system/core), i found this right below the library method:
Code:
function model($model, $name = '', $db_conn = FALSE)
{
if (is_array($model))
{
foreach($model as $babe)
{
$this->model($babe);
}
return;
}
Hah thought that was pretty funny.