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 |
||
(3 intermediate revisions by the same user not shown) | |||
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) | ||
== 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? | |||
<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><div style="border-style:dotted; border-width:0px; border-top-width:1px; border-color:#888888; padding-bottom:-4px;"><sup>Posted by [[:User:Blocco|blocco]] ([[:User_talk:Blocco|talk]]) on Jul 30, 2011 (Saturday) at 15:29 (UTC) [[:User talk:Blocco/sig#format|[Discuss format]]]</sup></div> |
Latest 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)
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