mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
fix example assert
This commit is contained in:
parent
e0e376a370
commit
1be01b716b
|
@ -32,10 +32,14 @@ int main() {
|
||||||
// number is its own memory: was passed by value
|
// number is its own memory: was passed by value
|
||||||
// So does not change
|
// So does not change
|
||||||
|
|
||||||
assert(lua["test"]["ref_number"] == 25);
|
assert(lua["test"]["ref_number"] == 542);
|
||||||
// ref_number is just test::number
|
// ref_number is just test::number
|
||||||
// passed through std::ref
|
// passed through std::ref
|
||||||
// so, it holds a reference
|
// 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;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user