Show Changes Show Changes
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Topic Locks Topic Locks



2/22/2017 3:52:54 AM
11/23/2009 2:25:44 PM
3/11/2008 6:56:36 AM
10/4/2007 5:59:11 PM
7/10/2007 3:41:20 PM
List all versions List all versions

RSS feed for the SquirrelWiki namespace

Sq Plus FAQ


Back to SqPlus


What to do about the "the index <index> does not exist" error while using SqPlus to call a function in Squirrel.

Sometimes, when you have bound a class properly using SqPlus, calling a function with that class as a parameter will lead to this error. If there aren't any typos in your squirrel script, you may be left wondering how there could be an invalid index when that function is sitting right there. The problem is that in this case, Squirrel mangles the error code, the problem may actually lie somewhere else entirely. This link:

depicts a problem where the error was occurring in SqPlus::Push, formed by the DECLARE_INSTANCE_TYPE macro. Be sure to step through the code carefully if the error seems irrelevant.

SqPlus throws the error 'getVar(): Could not create instance: <instance name>'

The problem stems from SqPlus not knowing how to create an instance of the specified type. Check your DECLARE_INSTANCE_TYPE macro and make sure that the text in SqClassDef<>() matches your declared type.

 SqClassDef<FooBar>("FooBar") ;


 DECLARE_INSTANCE_TYPE_NAME( SomeNamespace::FooBar, Foo )
 SqClassDef<SomeNamespace::FooBar>("Foo") ;

Something like this would generate an error:

 DECLARE_INSTANCE_TYPE_NAME( SomeNamespace::FooBar, FooBar )
 SqClassDef<SomeNamespace::FooBar>("Foo") ; // this is wrong 'Foo' doesn't match 'FooBar'

Binding structs/classes by reference or by pointer

In cases where performance is important, bind structs/classes as pointers to structs/classes as opposed to references to them. Due to the SqPlus system design, arguments and/or return values bound as references will cause memory to be allocated, and the referenced item to be copied (the memory will be freed when the copied item is no longer in scope).

Not logged in. Log in

squirrel's community wiki

This is FlexWiki, an open source wiki engine.

Change Style

Recent Topics