ID:960762
 
(See the best response by Nadrew.)
Code:
mob/proc/GetPosts(Type)
var
list/PostList=list()
for(var/Post/P in Posts)
if(P.category==Type)
PostList+=P
var/end = PostList.len*10
var/start = end-global.PostPerPage
var/list/L=PostList.Cut(start,end+1)
return L


Problem description:Here is what i am trying to do i have a datum called Post and a list called Posts when player uses verb display Posts the verb gets list using this proc and this proc does 2 jobs for me
1.) Get Posts by category
2.) Cut them in the sets of 10 then return the list
but this is not happening instead it is just giving me runtime errors any help would be nice.

Best response
You're setting the 'end' variable well beyond what the length of the list will ever be, so you'll always get an out of bounds error since you're trying to Cut() to a length that's higher than the length of the list.