Lines Matching refs:state
30 /// Demonstrates how RAII helps in keeping the Lua state consistent.
40 /// developer in maintaining the Lua state consistent at all times in a
50 #include <lutok/state.ipp>
58 /// \pre The top of the Lua stack in 'state' references a table.
60 /// \param state The Lua state.
63 print_table_field(lutok::state& state, const std::string& field)
65 assert(state.is_table());
74 lutok::stack_cleaner cleaner(state);
77 state.push_string(field);
79 state.get_table();
82 if (!state.is_string()) {
97 std::cout << "String in field " << field << ": " << state.to_string()
100 // return it to its original state. Mostly for clarity.
101 state.pop(1);
113 lutok::state state;
114 state.open_base();
116 lutok::do_string(state, "example = {foo='hello', bar=123, baz='bye'}");
118 state.get_global("example");
119 print_table_field(state, "foo");
120 print_table_field(state, "bar");
121 print_table_field(state, "baz");
122 state.pop(1);