User talk:Megamatrixdude/How To Get An Asset's Image

From Legacy Roblox Wiki
Revision as of 15:29, 30 July 2011 by >Blocco
Jump to navigationJump to search

I get an internal server error when I go to that link...? --crazypotato4 20:55, 26 July 2011 (UTC)

Alternative way of getting URL

Can't you just make something like: "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=%d&height=%d&assetId=%d" and use string::format?

local baseTexture = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=%d&height=%d&assetId=%d";
function GetAssetTexture(aId, w, h)
	if aId == nil or type(aId) ~= "number" or (type(aId) == "number" and aId%1 ~= 0) then error("Bad argument #1 to GetAssetTexture (integer expected, got " .. type(aId) .. ")") end
	return baseTexture:format(w or 110, h or 110, aId);
end
Posted by blocco (talk) on Jul 30, 2011 (Saturday) at 15:29 (UTC) [Discuss format]