Show Changes Show Changes
Edit Edit
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

Search

History

2/22/2017 3:52:54 AM
-92.222.238.172
11/23/2009 2:25:44 PM
116.41.33.14
3/11/2008 6:56:36 AM
213.247.207.110
10/4/2007 5:59:11 PM
-68.153.117.50
7/10/2007 3:41:20 PM
ad-remover-84.49.122.139
List all versions List all versions

RSS feed for the SquirrelWiki namespace

Sq Plus FAQ
.

taricacellid

Back to SqPlus

Summary

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:

http://www.squirrel-lang.org/forums/629/ShowPost.aspx

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. (http://www.chinesisches-horoskop.xyz/)

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.

 DECLARE_INSTANCE_TYPE( FooBar )
 SqClassDef<FooBar>("FooBar") ;

or

 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