WapTrick360


Share Your Creativity For Wapka
Home » Wapmaster codes » [LUA] Random post list code

local post_check, post_check_list, post_check_stats = api.post_info()
post_total = tonumber(post_check_stats['total'])


local is_ok, list = api.post_info({limit=post_total})
if is_ok then
  -- Shuffle the list to get random posts
  math.randomseed(os.time())
  for i = #list, 2, -1 do
    local j = math.random(i)
    list[i], list[j] = list[j], list[i]
  end

  -- Display 5 random posts
  for i = 1, math.min(5, #list) do
    print("Post ID:", list[i].id)
    print("Post Title:", list[i].title)
    print("<br/>")
  end
else
  print("Failed to fetch post info")
end



Total likes [1] admin
For comment section please Login Or Registration Here
Recent Comments
There are no comments yet
2025 WapTrick360
Version 2.0