Map Modul for MM2

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Map Modul for MM2

#1 Post by BlubBlab » Thu Nov 27, 2014 8:42 am

This is my map module for MM2 which is thread safe.

I tested it base functionality and it works.

With it you can safe any primitive type in MM2, you can also save any other but I can't guarantee what happened than anything will cast to a pointer than and pushed back as userdata than.

primitives are:
bool, int, float, string,char

not primitives are:
functions, tables, coroutines

API(short):

Code: Select all

-- bring a value to the map
map.set(string_key, primitive_value);
-- get a value out of the map
local value = map.get(string_key);
--check if a value in the map
local bool_var = map.has(string_key);
--clear the whole map
map.clear().
--remove a value
map.remove(string_key);

The map will hold the values even after the script ended because of that use map.clear() at the end of the script(or you want to keep the values)

There is also for each function another version with a u for unsigned int e.g. map.getu(string_key).(not so tested)
The int values are 64-bit intern.

PS: e.g The LT_FUNCTION ~= LUA_TFUNCTION was kinda confusing
Attachments
map_lua.cpp
(8.08 KiB) Downloaded 227 times
map_lua.h
(915 Bytes) Downloaded 230 times
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests