If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Notes:Roblox (Windows, Mac OS X)

From The Cutting Room Floor
Jump to navigation Jump to search

This page contains notes for the game Roblox (Windows, Mac OS X).

Cool archived builds. https://github.com/MaximumADHD/Roblox-2007-Client https://archive.org/details/ROBLOX20072013

I figured this might be usefull:

Getting the time an asset was updated for the last time

Well just put this code into a script located inside of ServerScriptService. (This is for the specific versions of experiences.)

local asset = game:GetService("MarketplaceService"):GetProductInfo(PutYourAssetIdHere, Enum.InfoType.Asset, VersionValue)
local update_stamp = tostring(asset.Updated)

function ConvertTimeStamp(time_stamp)
	local date_pattern = "%d%d%d%d%-%d%d%-%d%d"
	local stamp_date = string.sub(time_stamp, string.find(time_stamp, date_pattern))

	local split_date = string.split(stamp_date, "-")

	local year = split_date[1]
	local month = split_date[2]
	local day = split_date[3]

	local elapsed_years = (year - 1970)
	local elapsed_months = month - 1
	local elapsed_days = day - 1

	return year, month, day
end

print(ConvertTimeStamp(update_stamp))

Use this if you want the overall last update time:

local asset = game:GetService(“MarketplaceService”):GetProductInfo(PutYourAssetIdHere)
local update_stamp = tostring(asset.Updated)

function ConvertTimeStamp(time_stamp)
	local date_pattern = “%d%d%d%d%A%d%d%A%d%d”
	local stamp_date = string.sub(time_stamp, string.find(time_stamp, date_pattern))

	local split_date = string.split(stamp_date, “-”)

	local year = split_date[1]
	local month = split_date[2]
	local day = split_date[3]

	local elapsed_years = (year - 1970)
	local elapsed_months = month - 1
	local elapsed_days = day - 1

	return year, month, day
end

print(ConvertTimeStamp(update_stamp))

User.lua

This is the Lua script for User.lua

local CorePackages = game:GetService("CorePackages")
local Players = game:GetService("Players")

local MockId = require(CorePackages.AppTempCommon.LuaApp.MockId)

local User = {}

User.PresenceType = {
	OFFLINE = "OFFLINE",
	ONLINE = "ONLINE",
	IN_GAME = "IN_GAME",
	IN_STUDIO = "IN_STUDIO",
}

function User.new()
	local self = {}

	return self
end

function User.mock()
	local self = User.new()

	self.id = MockId()

	self.isFetching = false
	self.isFriend = false
	self.lastLocation = nil
	self.name = "USER NAME"
	self.universeId = nil
	self.placeId = nil
	self.rootPlaceId = nil
	self.gameInstanceId = nil
	self.presence = User.PresenceType.OFFLINE
	self.membership = nil
	self.thumbnails = nil
	self.lastOnline = nil

	return self
end

function User.fromData(id, name, isFriend)
	local self = User.new()

	self.id = tostring(id)

	self.isFetching = false
	self.isFriend = isFriend
	self.lastLocation = nil
	self.name = name
	self.universeId = nil
	self.placeId = nil
	self.rootPlaceId = nil
	self.gameInstanceId = nil

	self.presence = (self.id == tostring(Players.LocalPlayer.UserId)) and User.PresenceType.ONLINE or nil
	self.thumbnails = nil
	self.lastOnline = nil

	return self
end

function User.compare(user1, user2)
	assert(not(user1 == nil and user2 == nil))
	assert(user1 == nil or typeof(user1) == "table")
	assert(user2 == nil or typeof(user2) == "table")

	-- Return false if any of the provided input is nil(empty).
	if not user1 or not user2 then
		return false
	end

	for field, valueInUser2 in pairs(user2) do
		if user1[field] ~= valueInUser2 then
			return false
		end
	end

	for field, valueInUser1 in pairs(user1) do
		if user2[field] ~= valueInUser1 then
			return false
		end
	end

	return true
end

function User.userPresenceToText(localization, user)
	local presence = user.presence
	local lastLocation = user.lastLocation

	if not presence then
		return ''
	end

	if presence == User.PresenceType.OFFLINE then
		return localization:Format("Common.Presence.Label.Offline")
	elseif presence == User.PresenceType.ONLINE then
		return localization:Format("Common.Presence.Label.Online")
	elseif (presence == User.PresenceType.IN_GAME) or (presence == User.PresenceType.IN_STUDIO) then
		if lastLocation ~= nil then
			return lastLocation
		else
			return localization:Format("Common.Presence.Label.Online")
		end
	end
end

return User