Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Mötley on Oct 10, 2016, 08:27 PM

Title: correct method of a using a table
Post by: Mötley on Oct 10, 2016, 08:27 PM
I'm rusty..


But this would be a correct method of a using a table instead of a class correct?

local Peripheral = {
    pins = {},
    id = 0,

    function setID(value) {
        if (value > -1 && value < 256) {
            id = value;
        }
    }
}

Peripheral.setID(4);

Just a standard question
Title: Re: correct method of a using a table
Post by: jWeb on Oct 10, 2016, 08:28 PM
Sure, think of them as namespaces. Although, if you want to access it in other files, you might want to make it global `Peripheral <- {  };`
Title: Re: correct method of a using a table
Post by: Mötley on Oct 10, 2016, 08:29 PM
NICE THANK YOU!!!