Lines Matching refs:state
41 #include <lutok/state.ipp>
59 /// \param state The Lua state.
63 lua_fs_basename(lutok::state& state)
65 if (!state.is_string())
67 const fs::path path(state.to_string());
69 state.push_string(path.leaf_name().c_str());
79 /// \param state The Lua state.
83 lua_fs_dirname(lutok::state& state)
85 if (!state.is_string())
87 const fs::path path(state.to_string());
89 state.push_string(path.branch_path().c_str());
99 /// \param state The Lua state.
103 lua_fs_exists(lutok::state& state)
105 if (!state.is_string())
107 const fs::path path(state.to_string());
109 state.push_boolean(fs::exists(path));
122 /// \param state The lua state.
127 files_iterator(lutok::state& state)
129 DIR** dirp = state.to_userdata< DIR* >(state.upvalue_index(1));
134 state.push_string(entry->d_name);
148 /// \param state The lua state.
152 files_gc(lutok::state& state)
154 PRE(state.is_userdata());
156 DIR** dirp = state.to_userdata< DIR* >();
173 /// \param state The Lua state.
177 lua_fs_files(lutok::state& state)
179 if (!state.is_string())
181 const fs::path path(state.to_string());
183 DIR** dirp = state.new_userdata< DIR* >();
185 state.new_table();
186 state.push_string("__gc");
187 state.push_cxx_function(files_gc);
188 state.set_table();
190 state.set_metatable();
199 state.push_cxx_closure(files_iterator, 1);
210 /// \param state The Lua state.
214 lua_fs_is_absolute(lutok::state& state)
216 if (!state.is_string())
218 const fs::path path(state.to_string());
220 state.push_boolean(path.is_absolute());
231 /// \param state The Lua state.
235 lua_fs_join(lutok::state& state)
237 if (!state.is_string(-2))
239 const fs::path path1(state.to_string(-2));
241 if (!state.is_string(-1))
243 const fs::path path2(state.to_string(-1));
245 state.push_string((path1 / path2).c_str());
258 /// \param s The Lua state.
260 fs::open_fs(lutok::state& s)