Desaster Posted December 6, 2013 Posted December 6, 2013 Hi how I can get the first 10 rows of a table like in sql (order a limit) ?
TAPL Posted December 6, 2013 Posted December 6, 2013 Try something like: SELECT column_name FROM table_name LIMIT 10
Desaster Posted December 6, 2013 Author Posted December 6, 2013 I mean in a lua table (sql was just an expl)
bandi94 Posted December 6, 2013 Posted December 6, 2013 for i,v in pairs(table) do -- Your stuff if i == 10 then break end end Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Castillo Posted December 6, 2013 Posted December 6, 2013 If your table is indexed, then you can simply do this: for index = 1, 10 do local data = myTable [ index ] end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted December 6, 2013 Posted December 6, 2013 If your table is indexed, then you can simply do this: for index = 1, 10 do local data = myTable [ index ] end And if the index doesnt exist? To improve: for index = 1, 10 do local data = myTable [ index ] if ( not data ) then break end end State: Inactive
Desaster Posted December 6, 2013 Author Posted December 6, 2013 my table is not indexed so the first sollution is the useful one anyways good to know this thnx all
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now