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

From Legacy Roblox Wiki
Jump to navigationJump to search
>Crazypotato4
?
>Blocco
No edit summary
Line 1: Line 1:
I get an internal server error when I go to that link...? --[[User:Crazypotato4|crazypotato4]] 20:55, 26 July 2011 (UTC)
I get an internal server error when I go to that link...? --[[User:Crazypotato4|crazypotato4]] 20:55, 26 July 2011 (UTC)
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?
<pre>
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
</pre>

Revision as of 15:29, 30 July 2011

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

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