StefanAlmighty Posted October 26, 2015 Share Posted October 26, 2015 Is it possible to create a table using a function like table.create? I looked but I couldn't find anything of the sort, or is there any alternatives? I want a unique table per player who runs the script. Any help is appreciated. Link to comment
KariiiM Posted October 26, 2015 Share Posted October 26, 2015 There's no function for that, you can create it by yourself myTable = {} Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 Is it possible to nest table? eg; mainTable = { subTable1 = { innerTable1 = { } } subTable2 = { innerTable2 = { } } -- etc.. } Link to comment
KariiiM Posted October 26, 2015 Share Posted October 26, 2015 Something like that is correct local mainTable = {} mainTable[1] = {} mainTable[2] = {} Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 Hmm okay, do I have to manually add mainTable[1], mainTable[2]. I require like 2000+ plus of these. Link to comment
KariiiM Posted October 26, 2015 Share Posted October 26, 2015 Hmm okay, do I have to manually add mainTable[1], mainTable[2]. I require like 2000+ plus of these. What you want to do? Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 For every house on my server I want a separate table. So for example, if I wanted to access house with ID 2041 I'd use this houseTable[2041] = { } but I don't want to manually add all of those tables. Link to comment
KariiiM Posted October 26, 2015 Share Posted October 26, 2015 For every house on my server I want a separate table. So for example, if I wanted to access house with ID 2041 I'd use this houseTable[2041] = { } but I don't want to manually add all of those tables. I understood you, what about you do that with SQL? Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 It needs to be tables, so is there a way? SQL won't help me here because I don't need to store data. The system is for a robbery system where players can rob a house, and items are randomly generated into the table. Link to comment
KariiiM Posted October 26, 2015 Share Posted October 26, 2015 It needs to be tables, so is there a way? SQL won't help me here because I don't need to store data.The system is for a robbery system where players can rob a house, and items are randomly generated into the table. Post part of your code Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 I've sorted it now, one more thing though. How do I disable a players animation? Link to comment
sanyisasha Posted October 26, 2015 Share Posted October 26, 2015 It's "OOP" in MTA Lua. Example: local functions = { create = function(var1,var2) ... end, delete = function(var1,var2,var3) ... end} local created = functions.create(var1,var2) Link to comment
MTA Team botder Posted October 26, 2015 MTA Team Share Posted October 26, 2015 That's not OOP. You only nested functions inside a table. Link to comment
StefanAlmighty Posted October 26, 2015 Author Share Posted October 26, 2015 How can I disable an animation? Link to comment
Addlibs Posted October 27, 2015 Share Posted October 27, 2015 Set animation to an empty set and empty animation, i.e setPedAnimation(localPlayer, "", "") --Of course, replace localPlayer with the ped element who's animation you want to stop Link to comment
sanyisasha Posted October 27, 2015 Share Posted October 27, 2015 OOP: https://wiki.multitheftauto.com/wiki/OOP My example is more usefull. Element = { create = createElement, setPosition = setElementPosition, ... } Link to comment
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