Skip to content

Commit

Permalink
fix example assert
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhD committed Oct 6, 2016
1 parent e0e376a commit 1be01b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/usertype_var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ int main() {
// number is its own memory: was passed by value
// So does not change

assert(lua["test"]["ref_number"] == 25);
assert(lua["test"]["ref_number"] == 542);
// ref_number is just test::number
// passed through std::ref
// so, it holds a reference
// which can be updated
// be careful about referencing local variables,
// if they go out of scope but are still reference
// you'll suffer dangling reference bugs!

return 0;
}

0 comments on commit 1be01b7

Please sign in to comment.