![]() |
Show Changes |
![]() |
Edit |
![]() |
|
![]() |
Recent Changes |
![]() |
Subscriptions |
![]() |
Lost and Found |
![]() |
Find References |
![]() |
Rename |
![]() |
Administration Page |
![]() |
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 |
taricacellid
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/)
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'
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).