Fixing documentation. Adding an example.

This commit is contained in:
Artem Serebriyskiy 2014-03-02 19:10:11 +04:00
commit 6b18d20979
6 changed files with 110 additions and 8 deletions

View file

@ -1346,15 +1346,20 @@ int module_variable = 9;
namespace MyWorld {
class World {
public:
World():
world_max_count(9) {}
int create_world() { return 17; }
const int world_max_count = 9;
const int world_max_count; // = 9
};
namespace Nested {
class Dweller {
enum Gender { MALE, FEMALE };
static int populate_cave() { return 19; }
int create_cave() { return 13; }
int food_count; // = 11
public:
Dweller():
food_count(11) {}
enum Gender { MALE = 0, FEMALE = 1 };
static int populate_cave() { return 19; }
int create_cave() { return 13; }
int food_count; // = 11
};
}
}
@ -1364,15 +1369,13 @@ Now, from Lua usage is as follows:
> print(example.module_function())
7
> print(example.module_variable)
8
9
> print(example.MyWorld.World():create_world())
17
> print(example.MyWorld.World.world_max_count)
9
> print(example.MyWorld.Nested.Dweller.MALE)
0
> print(example.MyWorld.Nested.Dweller().food_count)
11
>
</pre></div>
<H4> Backward compatibility </H4>