Jump to content

What to do with the nill in a table?


IIYAMA

Recommended Posts

  • Moderators

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?

Link to comment
  • Moderators

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

Link to comment
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] }.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...