[lua] Fix a bug in SWIG_ALLOC_ARRAY()
improved the error messages for incorrect arguments. Changed the output of swig_type() to use the human readable form of the type, rather than the raw swig type. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9863 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d269f9cd16
commit
c3ec8fdce3
8 changed files with 58 additions and 14 deletions
|
|
@ -399,7 +399,7 @@ Unlike many scripting languages, Lua has had support for pointers to C/C++ objec
|
|||
> print(f)
|
||||
userdata: 003FDA80
|
||||
> print(swig_type(f))
|
||||
_p_FILE -- its a FILE*
|
||||
FILE * -- its a FILE*
|
||||
</pre></div>
|
||||
<p>
|
||||
Lua enforces the integrity of its userdata, so it is virtually impossible to corrupt the data. But as the user of the pointer, you are responsible for freeing it, or closing any resources associated with it (just as you would in a C program). This does not apply so strictly to classes & structs (see below). One final note: if a function returns a NULL pointer, this is not encoded as a userdata, but as a Lua nil.
|
||||
|
|
@ -1087,7 +1087,7 @@ __index function: 003FB698
|
|||
.fn table: 003FB528
|
||||
</pre></div>
|
||||
<p>
|
||||
The '.type' attribute is the string which is returned from a call to swig_type(). The '.get' and '.set' tables work in a similar manner to the modules, the main difference is the '.fn' table which also holds all the member functions. (The '__gc' function is the classes destructor function)
|
||||
The '.type' attribute is the name of the class. The '.get' and '.set' tables work in a similar manner to the modules, the main difference is the '.fn' table which also holds all the member functions. (The '__gc' function is the classes destructor function)
|
||||
</p>
|
||||
<p>
|
||||
The Lua equivalent of the code for enabling functions looks a little like this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue