Nasal/CppBind: Difference between revisions

Jump to navigation Jump to search
m
Line 143: Line 143:
Rebuild & run FlightGear, and then fire up the [[Nasal Console]], and run this:
Rebuild & run FlightGear, and then fire up the [[Nasal Console]], and run this:
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
# inspect our new test namespace
debug.dump( test );
# create a test object:
var obj = test.new();


# inspect the test namespace
debug.dump( test );
# inspect the result of running our allocator function
# inspect the result of running our allocator function
debug.dump( var t=test.new() );
debug.dump( obj );
# dump the x,y,z members to the console
foreach(var e; ['x','y','z'])
print ( t[e] );
   
   
# run the hello method
# run the hello method
var t = test.new();
obj.hello();
t.hello();
 
# print the value
print( obj.value );
 
# change the value
obj.value = 4444;
 
# print it again
print( obj.value );
 
</syntaxhighlight>
</syntaxhighlight>


Navigation menu