FUNExtreme

Global tables

Recommended Posts

Hello,

I currently understand almost everything of the lua coding structure although there is one thing that keeps annoying me.

Tables,

I'm able to use them when it comes to the script where they are created but from the moment I try to use them globaly it gives errors.

So my question: Is it possible to use tables as a global variable?

Note: I didn't make them local xp

Share this post


Link to post

I don't understand the problem. Can you please explain what errors you're getting? And can you please show us some code so we can see what you're trying to do?

Share this post


Link to post

I'm trying to use a table wich was created in (for example) table.lua inside the script table1.lua

You understand what I mean?

Share this post


Link to post

As long as their both on the same side (server or client) and the table is not local, it'll work.

But still: Give us your code, or nobody will be able to help you.

Share this post


Link to post

So if I understand correctly, the only way it would give trouble is when the table.lua (where the table is) is server-side and the other script where I try to use it is client-side?

If that is correct then I found my problem :P

Share this post


Link to post

tables work exactly like any other variable. Let's say you have a server side variable serverVar = "niceHair". It can be called from server side scripts of that resource. Same case if you had a server side table serverTable = {}. You can operate with it only server side.

Share this post


Link to post

Ok thanks,

Because I didn't know that I just wasted a couple of houres debugging and trying other things xD

Share this post


Link to post

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.