Unique ID
Hello everyone
Is there a specific function to create an unique ID? The ID could be a string, integer or float. Can work with all of that. It just should be unique over time. As far as I've searched the web, LUA doesn't provide a "get unique" function like other languages. How I'm doing it now: Code:
a unique ID per day: os.date('D%Y%m%d') Thanks gamemodul |
Do you need the id based on an item ingame or just without any relevance to the items (I guess so as you wrote "over time unique").
If you have an item relevance you could use: Lua Code:
http://www.esoui.com/forums/showthre...ghlight=unique |
Hi Baertram
Yes, don't need an Item related ID. Basically I'm adding items to a table. The key constructed with os.time() inside allows me to parse the items ordered by time (also saves an extra value inside the item itself). Adding that os.rawclock() because that might be the most unique thing that I can get if items where added really fast. Like this: Code:
sometable = { |
Why not use a simple index which increments with each item added?
|
Because... too easy! Just kidding ;)
That was how I first did it. Before I started to overthink things I guess. The more I think about the thing now, the more I think that's the way to go again. The time can be easily added as value so it doesn't get lost and my script doesn't read these keys anymore. So... ye, thank you guys for the input! |
All times are GMT -6. The time now is 09:19 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI