7#include <unordered_map>
20 std::shared_ptr<void> data;
39 SL_SYMBOL
static std::shared_ptr<void>
emplace(
const T& value);
42 using Map = std::unordered_map<std::string, Data>;
45 SL_SYMBOL
Table(
const Map& map);
58 SL_SYMBOL
const Data& getRaw(
const std::string& name)
const;
61 SL_SYMBOL
void each(std::function<
void(uint32_t, T&)> lambda);
64 SL_SYMBOL
void each(std::function<
void(uint32_t,
const T&)> lambda)
const;
67 SL_SYMBOL
void try_get(
const std::string& name, std::function<
void(T&)> lambda, std::optional<std::function<
void()>> if_not = std::nullopt);
70 SL_SYMBOL
void try_get(
const std::string& name, std::function<
void(
const T&)> lambda, std::optional<std::function<
void()>> if_not = std::nullopt)
const;
90 SL_SYMBOL
bool hasValue(
const std::string& name)
const;
99 SL_SYMBOL T&
get(
const std::string& name);
102 SL_SYMBOL std::vector<T>
get()
const;
111 SL_SYMBOL
const T&
get(
const std::string& name)
const;
112 SL_SYMBOL
void*
get(
const std::string& name)
const;
121 SL_SYMBOL
void set(
const std::string& name,
const T& value);
122 SL_SYMBOL
void set(
const std::string& name,
void* value);
136 SL_SYMBOL
void fromStack(State L);
138 SL_SYMBOL std::string toString(uint32_t indent = 0)
const;
Represents a value in the table stored in memory with a type.
Definition Table.hpp:19
static SL_SYMBOL std::shared_ptr< void > emplace(const T &value)
Allocate room and copy the memory of a given value.
static SL_SYMBOL Data fromValue(const T &value)
Construct a data entry from a value.
SL_SYMBOL void superimpose(const Map &map)
Copy the entries from a map into this table.
SL_SYMBOL Table(State L)
Constructs a table from the current Lua stack.
SL_SYMBOL const Map & getMap() const
Get the raw mapping of this table.
SL_SYMBOL const T & get(const std::string &name) const
Get a constant reference to a value in the table.
SL_SYMBOL T & get(const std::string &name)
Get a reference to a value in the table.
SL_SYMBOL void toStack(State L) const
Dump all the map information onto the given Lua stack.
SL_SYMBOL void set(const std::string &name, const T &value)
Set the value associated with a key.
SL_SYMBOL void fromTable(const Table &table)
Make the entries equivalent to another table.
SL_SYMBOL void superimpose(const Table &table)
Copy the entries from a table into this table.