LuaHashMap  1.0.0
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
LuaHashMap.h File Reference

Go to the source code of this file.

Data Structures

struct  LuaHashMapVersion
 Struct that contains the version information of this library. More...
 
struct  LuaHashMapStringContainer
 
union  LuaHashMapKeyValueType
 
struct  LuaHashMapIterator
 Defines the iterator type for LuaHashMap. More...
 

Macros

#define LUAHASHMAP_MAJOR_VERSION   1
 
#define LUAHASHMAP_MINOR_VERSION   0
 
#define LUAHASHMAP_PATCHLEVEL   0
 
#define LUAHASHMAP_GET_COMPILED_VERSION(X)
 This macro fills in a version structure with the version of the library you compiled against.
 
#define LUAHASHMAP_SHOULD_USE_C_GENERICS   1
 
#define LuaHashMap_SetValueForKey(hash_map, value, key)
 LuaHashMap_SetValueForKey.
 
#define LuaHashMap_SetValueForKeyWithLength(hash_map, value, key, strlength)
 LuaHashMap_SetValueForKeyWithLength.
 
#define LuaHashMap_SetValueAtIterator(hash_iterator, value)
 LuaHashMap_SetValueAtIterator.
 
#define LuaHashMap_SetValue(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_SETVALUE_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_SetValue.
 
#define LuaHashMap_GetValueStringForKey(hash_map, key)
 LuaHashMap_GetValueStringForKey.
 
#define LuaHashMap_GetValueStringForKeyWithLength(hash_map, key, strlengthoutptr)
 LuaHashMap_GetValueStringForKeyWithLength.
 
#define LuaHashMap_GetValueString(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUESTRING_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_GetValueString.
 
#define LuaHashMap_GetValuePointerForKey(hash_map, key)
 LuaHashMap_GetValuePointerForKey.
 
#define LuaHashMap_GetValueNumberForKey(hash_map, key)
 LuaHashMap_GetValueNumberForKey.
 
#define LuaHashMap_GetValueIntegerForKey(hash_map, key)
 LuaHashMap_GetValueIntegerForKey.
 
#define LuaHashMap_GetValuePointer(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUEPOINTER_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_GetValuePointer.
 
#define LuaHashMap_GetValueNumber(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUENUMBER_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_GetValueNumber.
 
#define LuaHashMap_GetValueInteger(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_GETVALUEINTEGER_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_GetValueInteger.
 
#define LuaHashMap_ExistsKey(hash_map, key)
 LuaHashMap_ExistsKey.
 
#define LuaHashMap_Exists(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_EXISTS_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_Exists.
 
#define LuaHashMap_RemoveKey(hash_map, key)
 LuaHashMap_RemoveKey.
 
#define LuaHashMap_Remove(...)   LUAHASHMAP_MACRO_DISPATCHER(LUAHASHMAP_REMOVE_, __VA_ARGS__)(__VA_ARGS__)
 LuaHashMap_Remove.
 
#define LuaHashMap_GetIteratorForKey(hash_map, key)
 LuaHashMap_GetIteratorForKey.
 
#define LUAHASHMAP_SUPPORTS_GENERICS   1
 Defined only if C11 _Generic support has been detected.
 

Typedefs

typedef struct LuaHashMap LuaHashMap
 
typedef int LuaHashMap_InternalGlobalKeyType
 

Functions

const LuaHashMapVersionLuaHashMap_GetLinkedVersion (void)
 Gets the library version of the dynamically linked library you are using.
 
LuaHashMapLuaHashMap_Create (void)
 Creates a new instance of a hash table.
 
LuaHashMapLuaHashMap_CreateWithAllocator (lua_Alloc the_allocator, void *user_data)
 Creates a new instance of a hash table with a custom allocator.
 
LuaHashMapLuaHashMap_CreateWithSizeHints (int number_of_array_elements, int number_of_hash_elements)
 Creates a new instance of a hash table with a suggested starting size.
 
LuaHashMapLuaHashMap_CreateWithAllocatorAndSizeHints (lua_Alloc the_allocator, void *user_data, int number_of_array_elements, int number_of_hash_elements)
 Creates a new instance of a hash table with a custom allocator and a suggested starting size.
 
LuaHashMapLuaHashMap_CreateShare (LuaHashMap *original_hash_map)
 Special Memory Optimization: Allows you to create new LuaHashMaps from an existing one which will share the same lua_State under the hood.
 
LuaHashMapLuaHashMap_CreateShareWithSizeHints (LuaHashMap *original_hash_map, int number_of_array_elements, int number_of_hash_elements)
 Just like LuaHashMap_CreateShare, except it allows you to pre-size the hash map.
 
LuaHashMapLuaHashMap_CreateShareFromLuaState (lua_State *lua_state)
 Special Memory Optimization: Allows you to create new LuaHashMaps from an existing lua_State.
 
LuaHashMapLuaHashMap_CreateShareFromLuaStateWithAllocatorAndSizeHints (lua_State *lua_state, lua_Alloc the_allocator, void *user_data, int number_of_array_elements, int number_of_hash_elements)
 Just like LuaHashMap_CreateShareFromLuaState but lets you specify your own allocator and pre-size hints.
 
LuaHashMapLuaHashMap_CreateShareFromLuaStateWithSizeHints (lua_State *lua_state, int number_of_array_elements, int number_of_hash_elements)
 Just like LuaHashMap_CreateShareFromLuaState but lets you specify your own pre-size hints.
 
void LuaHashMap_Free (LuaHashMap *hash_map)
 Frees a LuaHashMap instance.
 
void LuaHashMap_FreeShare (LuaHashMap *hash_map)
 Frees a LuaHashMap instance (intended for those created with LuaHashMap_CreateShare or LuaHashMap_CreateShareFromLuaState).
 
lua_State * LuaHashMap_GetLuaState (LuaHashMap *hash_map)
 Returns the lua_State being used by the LuaHashMap.
 
const char * LuaHashMap_SetValueStringForKeyString (LuaHashMap *restrict hash_map, const char *value_string, const char *key_string)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValueStringForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *value_string, const char *key_string, size_t value_string_length, size_t key_string_length)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValuePointerForKeyString (LuaHashMap *hash_map, void *value_pointer, const char *key_string)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValuePointerForKeyStringWithLength (LuaHashMap *hash_map, void *value_pointer, const char *key_string, size_t key_string_length)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValueNumberForKeyString (LuaHashMap *restrict hash_map, lua_Number value_number, const char *restrict key_string)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValueNumberForKeyStringWithLength (LuaHashMap *restrict hash_map, lua_Number value_number, const char *restrict key_string, size_t key_string_length)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValueIntegerForKeyString (LuaHashMap *restrict hash_map, lua_Integer value_integer, const char *restrict key_string)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_SetValueIntegerForKeyStringWithLength (LuaHashMap *restrict hash_map, lua_Integer value_integer, const char *restrict key_string, size_t key_string_length)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyPointer (LuaHashMap *hash_map, const char *value_string, void *key_pointer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyPointerWithLength (LuaHashMap *hash_map, const char *value_string, void *key_pointer, size_t value_string_length)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValuePointerForKeyPointer (LuaHashMap *hash_map, void *value_pointer, void *key_pointer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueNumberForKeyPointer (LuaHashMap *hash_map, lua_Number value_number, void *key_pointer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueIntegerForKeyPointer (LuaHashMap *hash_map, lua_Integer value_integer, void *key_pointer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyNumber (LuaHashMap *restrict hash_map, const char *restrict value_string, lua_Number key_number)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyNumberWithLength (LuaHashMap *restrict hash_map, const char *restrict value_string, lua_Number key_number, size_t value_string_length)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValuePointerForKeyNumber (LuaHashMap *hash_map, void *value_pointer, lua_Number key_number)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueNumberForKeyNumber (LuaHashMap *hash_map, lua_Number value_number, lua_Number key_number)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueIntegerForKeyNumber (LuaHashMap *hash_map, lua_Integer value_integer, lua_Number key_number)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyInteger (LuaHashMap *restrict hash_map, const char *restrict value_string, lua_Integer key_integer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueStringForKeyIntegerWithLength (LuaHashMap *restrict hash_map, const char *restrict value_string, lua_Integer key_integer, size_t value_string_length)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValuePointerForKeyInteger (LuaHashMap *hash_map, void *value_pointer, lua_Integer key_integer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueNumberForKeyInteger (LuaHashMap *hash_map, lua_Number value_number, lua_Integer key_integer)
 Adds a given key-value pair to the hash table.
 
void LuaHashMap_SetValueIntegerForKeyInteger (LuaHashMap *hash_map, lua_Integer value_integer, lua_Integer key_integer)
 Adds a given key-value pair to the hash table.
 
const char * LuaHashMap_GetValueStringForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t *restrict value_string_length_return, size_t key_string_length)
 Returns the value for specified key in the hash table.
 
void * LuaHashMap_GetValuePointerForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns the value for specified key in the hash table.
 
void * LuaHashMap_GetValuePointerForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Returns the value for specified key in the hash table.
 
lua_Number LuaHashMap_GetValueNumberForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns the value for specified key in the hash table.
 
lua_Number LuaHashMap_GetValueNumberForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Returns the value for specified key in the hash table.
 
lua_Integer LuaHashMap_GetValueIntegerForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns the value for specified key in the hash table.
 
lua_Integer LuaHashMap_GetValueIntegerForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyPointerWithLength (LuaHashMap *hash_map, void *key_pointer, size_t *value_string_length_return)
 Returns the value for specified key in the hash table.
 
void * LuaHashMap_GetValuePointerForKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns the value for specified key in the hash table.
 
lua_Number LuaHashMap_GetValueNumberForKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns the value for specified key in the hash table.
 
lua_Integer LuaHashMap_GetValueIntegerForKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyNumberWithLength (LuaHashMap *restrict hash_map, lua_Number key_number, size_t *restrict value_string_length_return)
 Returns the value for specified key in the hash table.
 
void * LuaHashMap_GetValuePointerForKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns the value for specified key in the hash table.
 
lua_Number LuaHashMap_GetValueNumberForKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns the value for specified key in the hash table.
 
lua_Integer LuaHashMap_GetValueIntegerForKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns the value for specified key in the hash table.
 
const char * LuaHashMap_GetValueStringForKeyIntegerWithLength (LuaHashMap *restrict hash_map, lua_Integer key_integer, size_t *restrict value_string_length_return)
 Returns the value for specified key in the hash table.
 
void * LuaHashMap_GetValuePointerForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns the value for specified key in the hash table.
 
lua_Number LuaHashMap_GetValueNumberForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns the value for specified key in the hash table.
 
lua_Integer LuaHashMap_GetValueIntegerForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns the value for specified key in the hash table.
 
bool LuaHashMap_ExistsKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns whether a key/value pair exists in the hash table for a specified key.
 
bool LuaHashMap_ExistsKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Returns whether a key/value pair exists in the hash table for a specified key.
 
bool LuaHashMap_ExistsKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns whether a key/value pair exists in the hash table for a specified key.
 
bool LuaHashMap_ExistsKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns whether a key/value pair exists in the hash table for a specified key.
 
bool LuaHashMap_ExistsKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns whether a key/value pair exists in the hash table for a specified key.
 
void LuaHashMap_RemoveKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Removes a key/value pair in the hash table for a specified key.
 
void LuaHashMap_RemoveKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Removes a key/value pair in the hash table for a specified key.
 
void LuaHashMap_RemoveKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Removes a key/value pair in the hash table for a specified key.
 
void LuaHashMap_RemoveKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Removes a key/value pair in the hash table for a specified key.
 
void LuaHashMap_RemoveKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Removes a key/value pair in the hash table for a specified key.
 
void LuaHashMap_Clear (LuaHashMap *hash_map)
 Removes all entries from the hash table, but doesn't shrink the hash.
 
void LuaHashMap_Purge (LuaHashMap *hash_map)
 Removes all entries from the hash table and resets the hash size to 0 (reclaims memory) This removes all entries from the hash table and resets the hash size to 0 (reclaims memory).
 
bool LuaHashMap_IsEmpty (LuaHashMap *hash_map)
 Returns whether the hash table is empty or or not.
 
LuaHashMapIterator LuaHashMap_GetIteratorAtBegin (LuaHashMap *hash_map)
 Returns an iterator at the start position of the hash table.
 
LuaHashMapIterator LuaHashMap_GetIteratorAtEnd (LuaHashMap *hash_map)
 Returns an iterator at the end position of the hash table.
 
bool LuaHashMap_IteratorNext (LuaHashMapIterator *hash_iterator)
 Increments the iterator to the next item in the hash table.
 
LuaHashMapIterator LuaHashMap_GetIteratorForKeyString (LuaHashMap *restrict hash_map, const char *restrict key_string)
 Returns an iterator corresponding to the specified key.
 
LuaHashMapIterator LuaHashMap_GetIteratorForKeyStringWithLength (LuaHashMap *restrict hash_map, const char *restrict key_string, size_t key_string_length)
 Returns an iterator corresponding to the specified key.
 
LuaHashMapIterator LuaHashMap_GetIteratorForKeyPointer (LuaHashMap *hash_map, void *key_pointer)
 Returns an iterator corresponding to the specified key.
 
LuaHashMapIterator LuaHashMap_GetIteratorForKeyNumber (LuaHashMap *hash_map, lua_Number key_number)
 Returns an iterator corresponding to the specified key.
 
LuaHashMapIterator LuaHashMap_GetIteratorForKeyInteger (LuaHashMap *hash_map, lua_Integer key_integer)
 Returns an iterator corresponding to the specified key.
 
bool LuaHashMap_IteratorIsNotFound (const LuaHashMapIterator *hash_iterator)
 Returns true if the iterator is "NotFound".
 
bool LuaHashMap_IteratorIsEqual (const LuaHashMapIterator *hash_iterator1, const LuaHashMapIterator *hash_iterator2)
 Returns true if two iterators are equal.
 
void LuaHashMap_SetValueStringAtIterator (LuaHashMapIterator *restrict hash_iterator, const char *restrict value_string)
 Updates a value in the hash table pointed to by the iterator.
 
void LuaHashMap_SetValueStringAtIteratorWithLength (LuaHashMapIterator *restrict hash_iterator, const char *restrict value_string, size_t value_string_length)
 Updates a value in the hash table pointed to by the iterator.
 
void LuaHashMap_SetValuePointerAtIterator (LuaHashMapIterator *hash_iterator, void *value_pointer)
 Updates a value in the hash table pointed to by the iterator.
 
void LuaHashMap_SetValueNumberAtIterator (LuaHashMapIterator *hash_iterator, lua_Number value_number)
 Updates a value in the hash table pointed to by the iterator.
 
void LuaHashMap_SetValueIntegerAtIterator (LuaHashMapIterator *hash_iterator, lua_Integer value_integer)
 Updates a value in the hash table pointed to by the iterator.
 
const char * LuaHashMap_GetValueStringAtIterator (LuaHashMapIterator *hash_iterator)
 Returns the value in the hash table pointed to by the iterator.
 
const char * LuaHashMap_GetValueStringAtIteratorWithLength (LuaHashMapIterator *restrict hash_iterator, size_t *restrict value_string_length_return)
 Returns the value in the hash table pointed to by the iterator.
 
void * LuaHashMap_GetValuePointerAtIterator (LuaHashMapIterator *hash_iterator)
 Returns the value in the hash table pointed to by the iterator.
 
lua_Number LuaHashMap_GetValueNumberAtIterator (LuaHashMapIterator *hash_iterator)
 Returns the value in the hash table pointed to by the iterator.
 
lua_Integer LuaHashMap_GetValueIntegerAtIterator (LuaHashMapIterator *hash_iterator)
 Returns the value in the hash table pointed to by the iterator.
 
bool LuaHashMap_ExistsAtIterator (LuaHashMapIterator *hash_iterator)
 Returns whether a key/value pair exists in the hash table pointed to by the iterator.
 
void LuaHashMap_RemoveAtIterator (LuaHashMapIterator *hash_iterator)
 Removes a key/value pair in the hash table pointed to by the iterator.
 
int LuaHashMap_GetValueTypeAtIterator (LuaHashMapIterator *hash_iterator)
 Returns the type of the value in the hash table pointed to by the iterator.
 
int LuaHashMap_GetKeyTypeAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the type of the key in the iterator.
 
const char * LuaHashMap_GetKeyStringAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the key corresponding to the iterator.
 
const char * LuaHashMap_GetKeyStringAtIteratorWithLength (const LuaHashMapIterator *restrict hash_iterator, size_t *restrict key_string_length_return)
 Returns the key corresponding to the iterator.
 
size_t LuaHashMap_GetKeyStringLengthAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the string length of the key corresponding to the iterator.
 
void * LuaHashMap_GetKeyPointerAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the key corresponding to the iterator.
 
lua_Number LuaHashMap_GetKeyNumberAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the key corresponding to the iterator.
 
lua_Integer LuaHashMap_GetKeyIntegerAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the key corresponding to the iterator.
 
int LuaHashMap_GetCachedValueTypeAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the type of the cached value in the iterator.
 
const char * LuaHashMap_GetCachedValueStringAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the cached value saved in the iterator.
 
const char * LuaHashMap_GetCachedValueStringAtIteratorWithLength (const LuaHashMapIterator *restrict hash_iterator, size_t *restrict value_string_length_return)
 Returns the cached value saved in the iterator.
 
size_t LuaHashMap_GetCachedValueStringLengthAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the string length of the cached value saved in the iterator.
 
void * LuaHashMap_GetCachedValuePointerAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the cached value saved in the iterator.
 
lua_Number LuaHashMap_GetCachedValueNumberAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the cached value saved in the iterator.
 
lua_Integer LuaHashMap_GetCachedValueIntegerAtIterator (const LuaHashMapIterator *hash_iterator)
 Returns the cached value saved in the iterator.
 
size_t LuaHashMap_Count (LuaHashMap *hash_map)
 (Experimental) Returns the number of items in the hash table.
 
size_t LuaHashMap_GetKeysString (LuaHashMap *hash_map, const char *keys_array[], size_t max_array_size)
 
size_t LuaHashMap_GetKeysPointer (LuaHashMap *hash_map, void *keys_array[], size_t max_array_size)
 
size_t LuaHashMap_GetKeysNumber (LuaHashMap *hash_map, lua_Number keys_array[], size_t max_array_size)
 
size_t LuaHashMap_GetKeysInteger (LuaHashMap *hash_map, lua_Integer keys_array[], size_t max_array_size)
 

Macro Definition Documentation

#define LUAHASHMAP_GET_COMPILED_VERSION (   X)
Value:
{ \
(X)->major = LUAHASHMAP_MAJOR_VERSION; \
(X)->minor = LUAHASHMAP_MINOR_VERSION; \
(X)->patch = LUAHASHMAP_PATCHLEVEL; \
}

This macro fills in a version structure with the version of the library you compiled against.

This is determined by what header the compiler uses. Note that if you dynamically linked the library, you might have a slightly newer or older version at runtime. That version can be determined with LuaHashMap_GetLinkedVersion(), which, unlike LUAHASHMAP_GET_COMPILED_VERSION, is not a macro.

Parameters
XA pointer to a LuaHashMapVersion struct to initialize.
See Also
LuaHashMapVersion, LuaHashMap_GetLinkedVersion
#define LUAHASHMAP_MAJOR_VERSION   1
#define LUAHASHMAP_MINOR_VERSION   0
#define LUAHASHMAP_PATCHLEVEL   0
#define LUAHASHMAP_SHOULD_USE_C_GENERICS   1

Typedef Documentation

typedef struct LuaHashMap LuaHashMap

Function Documentation

size_t LuaHashMap_Count ( LuaHashMap hash_map)

(Experimental) Returns the number of items in the hash table.

This returns the number of key/value pairs currently in your hash table. This is O(n). Since it is slow, it should be used sparingly.

Parameters
hash_mapThe LuaHashMap instance to operate on
Returns
Returns the number of items in the hash table.
size_t LuaHashMap_GetKeysInteger ( LuaHashMap hash_map,
lua_Integer  keys_array[],
size_t  max_array_size 
)
size_t LuaHashMap_GetKeysNumber ( LuaHashMap hash_map,
lua_Number  keys_array[],
size_t  max_array_size 
)
size_t LuaHashMap_GetKeysPointer ( LuaHashMap hash_map,
void *  keys_array[],
size_t  max_array_size 
)
size_t LuaHashMap_GetKeysString ( LuaHashMap hash_map,
const char *  keys_array[],
size_t  max_array_size 
)
const LuaHashMapVersion* LuaHashMap_GetLinkedVersion ( void  )

Gets the library version of the dynamically linked library you are using.

This gets the version of the library that is linked against your program. If you are using a shared library (DLL) version, then it is possible that it will be different than the version you compiled against.

This is a real function; the macro LUAHASHMAP_GET_COMPILED_VERSION tells you what version of the library you compiled against:

printf("We compiled against version %d.%d.%d ...\n",
compiled.major, compiled.minor, compiled.patch);
printf("But we linked against version %d.%d.%d.\n",
linked.major, linked.minor, linked.patch);
See Also
LuaHashMapVersion, LUAHASHMAP_GET_COMPILED_VERSION
lua_State* LuaHashMap_GetLuaState ( LuaHashMap hash_map)

Returns the lua_State being used by the LuaHashMap.

This is only for backdoor access. This is for very advanced use cases that want to directly interact with the Lua State.

Parameters
hash_mapThe LuaHashMap instance to operate on.
Returns
The lua_State used by the hash_map.