ertlflorian1 Posted July 12, 2013 Posted July 12, 2013 Why it dont work? carhouses = 5 for i=1, carhouses, 1 do "carhousetable"..i.."k" = "blabla" end
MIKI785 Posted July 12, 2013 Posted July 12, 2013 Because it doesn't make sense? You can't make string have some value O_o Lua Scripter Owner of mshost.cz MTA portal.
ertlflorian1 Posted July 12, 2013 Author Posted July 12, 2013 for i=1, carhouses, 1 do "carhousetable"..i.."k" = {} end
bandi94 Posted July 12, 2013 Posted July 12, 2013 for i=1, carhouses, 1 do "carhousetable"..i.."k" = {} end local carhouses=5 local carhousetable={} for i=1, carhouses, 1 do carhousetable[i]="blabla" end Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ertlflorian1 Posted July 12, 2013 Author Posted July 12, 2013 no i want to create 15 (carhouses value) tables: carhousetable1k carhousetable2k carhousetable3k carhousetable4k carhousetable5k ...
bandi94 Posted July 12, 2013 Posted July 12, 2013 no i want to create 15 (carhouses value) tables:carhousetable1k carhousetable2k carhousetable3k carhousetable4k carhousetable5k ... Make it by hand , there is no other way to create tabel's. Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ertlflorian1 Posted July 12, 2013 Author Posted July 12, 2013 carhouses is an value which I get from an Mysql database index
ertlflorian1 Posted July 12, 2013 Author Posted July 12, 2013 Thats the function how I get carhouses: carhouses = 0 local query = dbQuery ( handler, "SELECT * FROM carhouse_names") for i, row in pairs (dbPoll(query, -1)) do setElementData (root, "house"..row.ID, row.Name) carhouses = carhouses + 1 end
bandi94 Posted July 12, 2013 Posted July 12, 2013 Ok and after do you want to store the carhouses position in tabel's or what to do with them bk i dont get it. Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ertlflorian1 Posted July 12, 2013 Author Posted July 12, 2013 For every carhouse there would be createt an table where the names of the cars which you can buy in the carhouse are written
bandi94 Posted July 12, 2013 Posted July 12, 2013 For every carhouse there would be createt an table where the names of the cars which you can buy in the carhouse are written Let's try it with ElementData it offers more work space something like. local ElementTable={} for i=1, carhouses, 1 do local carhouse = createElement("car_house") ElementTable[i]=carhouse end Then something like for i=1, carhouses, 1 do for car=1, cars, 1 do local name = "car"..i.."" setElementData( ElementTable[i],name,car_name_table[j]) end end Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Cadu12 Posted July 12, 2013 Posted July 12, 2013 carhouses = 5 for i=1, carhouses, 1 do _G["carhousetable"..i.."k"] = "blabla" end outputChatBox(carhousetable1k) Not tested yet. Ingame nick: Cadu12
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