Moderators IIYAMA Posted November 16, 2012 Moderators Posted November 16, 2012 Hello guys, I have a very large table, but the problem is that 70% is "0" WeaponRecoil = {[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0..................ETC How can I make sure the table will be small. The numbers that will be something in the table is 0 t/m 47. (btw in some of my tables does have a "0", for sample you have explosion = 0 or unarmed = 0) A guy told me once, that I have to use "var" (remi-x) What is the best way to make a good table? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
denny199 Posted November 16, 2012 Posted November 16, 2012 I don't understand you. You want to make the table small? just something looks like this instead of 1=0, 2=0, 3=1, 4=0 etc.: 0 to 10 = 0 10 to 20 = 1 11 to 15 = 0 etc. etc. I hope that you will understand me to ;p Sometimes I dream about cheese
myonlake Posted November 16, 2012 Posted November 16, 2012 Perhaps don't make a table for all weapons if you don't want to change them from zero to anything. Only make a table for the weapons you want to change. If I helped you, please click the like button on the right Thanks!
Moderators IIYAMA Posted November 16, 2012 Author Moderators Posted November 16, 2012 How do you set a table like that? denny199 0 to 10 = 0 10 to 20 = 1 11 to 15 = 0 etc. etc. I get errors if I call a weapon/number, that does not exist in the table it self. Sample: I ask for 3, but the table is: omfg = {1=[1],2=[2]} -- 3 isn't inside. myonlake Perhaps don't make a table for all weapons if you don't want to change them from zero to anything. Only make a table for the weapons you want to change. How can I check with nil if the number isn't inside? Renkon You can use 'nil', unless I'm wrong Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anderl Posted November 16, 2012 Posted November 16, 2012 IIYAMA said: How do you set a table like that? denny199 0 to 10 = 0 10 to 20 = 1 11 to 15 = 0 etc. etc. I get errors if I call a weapon/number, that does not exist in the table it self. Sample: I ask for 3, but the table is: omfg = {1=[1],2=[2]} -- 3 isn't inside. myonlake Perhaps don't make a table for all weapons if you don't want to change them from zero to anything. Only make a table for the weapons you want to change. How can I check with nil if the number isn't inside? Renkon You can use 'nil', unless I'm wrong It's { [1] = 1, [2] = 2 } not { 1 = [1], 2 = [2] }. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Moderators IIYAMA Posted November 16, 2012 Author Moderators Posted November 16, 2012 ops sorry , just a sample :3 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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