fixed mistakes in the manual
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8080 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
06a3a305b1
commit
e0f65b85b1
1 changed files with 9 additions and 8 deletions
|
|
@ -465,16 +465,20 @@ you can use it in Lua like this:
|
|||
</p>
|
||||
<div class="targetlang"><pre>
|
||||
> l = example.List()
|
||||
> l.insert("Ale")
|
||||
> l.insert("Stout")
|
||||
> l.insert("Lager")
|
||||
> print(l.get(1))
|
||||
> l:insert("Ale")
|
||||
> l:insert("Stout")
|
||||
> l:insert("Lager")
|
||||
> print(l:get(1))
|
||||
Stout
|
||||
> print(l.length)
|
||||
> print(l:length)
|
||||
3
|
||||
>
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
(Note: for calling methods of a class, you use <tt>class:method(args)</tt>, not <tt>class.method(args)</tt>, its an easy mistake to make. However for data attributes it is <tt>class.attribute</tt>)
|
||||
</p>
|
||||
<p>
|
||||
Class data members are accessed in the same manner as C structures. Static class members present a special problem for Lua, as Lua doesn't have support for such features. Therefore, SWIG generates wrappers that try to work around some of these issues. To illustrate, suppose you have a class like this:
|
||||
</p>
|
||||
<div class="targetlang"><pre>class Spam {
|
||||
|
|
@ -680,9 +684,6 @@ When wrapped, it works like you expect:
|
|||
12.0
|
||||
</pre></div>
|
||||
<p>
|
||||
(Note: for calling methods of a class, you use <tt>class:method(args)</tt>, not <tt>class.method(args)</tt>, its an easy mistake to make.)
|
||||
</p>
|
||||
<p>
|
||||
One restriction with operator overloading support is that SWIG is not able to fully handle operators that aren't defined as part of the class. For example, if you had code like this
|
||||
</p>
|
||||
<div class="targetlang"><pre>class Complex {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue