How would I go about converting a MongoDB ObjectId into a timestamp? I want to sort objects that have an objectid in chronological order, but need to somehow do this in lua? This is how it is done in JavaScript:
var dateFromObjectId = function (objectId) {
return new Date(parseInt(objectId.substring(0, 8), 16) * 1000)
};
Most of it is quite easy to figure out, but I’m not sure what the equivalent or how to make “parseInt” in lua?