|
| 16 Jun 2014 01:29 PM |
I checked the wiki, I don't understand what it is, how to use it, nor why you would use it. Can anybody explain or at least give me an example of a Struct/using a Struct?
The only thing I know is it's properties making up a big property (So like maybe Position.X Position.Y Position.Z) and that it is a Data Type. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jun 2014 01:56 PM |
Think of a struct like a library. It is a way to organize variables etc.
One example is an array. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jun 2014 02:00 PM |
Where it says "other data structures"
It will show you different data structures that can be used in lua. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:03 PM |
| How can I use a Struct!?!?! |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:04 PM |
A struct (short for structure) allows you to make an 'object'. At least in C. Though there are no real objects in C.
Where are you trying to use it? They don't exist in Lua. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:05 PM |
| I just told you, look in the wiki, it will show you. -___- |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:08 PM |
@agent
http://wiki.roblox.com/index.php?title=Data_Types
In Roblox Lua, as well as most programming languages, you will encounter data types. These are the types of values that you can store in variables and used in code. Roblox Lua implements several new data types to Lua in addition to the native data types.
[edit]Native Lua These are usable in all Lua code - not just Roblox Lua.
Type Description Boolean Represents either true or false Coroutine An object that represents a splitting of the normal thread of execution Function Represents executable Lua code that can be ran with arguments Nil A state of non-being or nothingness Number A numerical quantity Integer A number without a fractional part (for example, -2 or 3, but not 4.5) String A chain of characters (for example, "hello") Table A list of key-value pairs Userdata An interface to the parent application [edit]Roblox Lua Specific These data types are specific to Roblox Lua and most of them have constructors.
Type Description Axes Represents a selection of X, Y and/or Z BrickColor Represents a color of a brick, has a name CFrame Represents a position and orientation in 3D space Color3 Represents a color Content A property that represents an image, sound, or mesh Enumeration Represents one of a specific selection (for example, CameraType) Faces Represents any combination of NormalIds (Front, Back, Left, Right, Top, Bottom) Instance An object in the Roblox game hierarchy Ray Represents a point and a direction in 3D space Region3 Represents a rectangular prism shaped space in 3D space Region3int16 Same as Region3 but with integral coordinates Struct Is a collection of properties to represent one property (not used in most Roblox Lua code) UDim Two of these are used with UDim2s UDim2 Used with GUI positions and sizing Vector2 A 2-dimensional vector. Also used as a 2D point Vector3 A 3-dimensional vector. Also used as a 3D point Vector3int16 Similar to Vector3, but uses integral coordinates. Used with Region3int16s Vector2int16 Similar to Vector2, but uses integral coordinates. Used with the PlayerMouse object CellId An unused data type that is related to terrain cells Category: Scripting Tutorials
It's there. It exists. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:10 PM |
| "(not used in most Roblox Lua code)" |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jun 2014 02:13 PM |
did you even check out what I gave you:
http://wiki.roblox.com/index.php?title=Struct
"SEE ALSO" (in bold)
|
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 16 Jun 2014 02:14 PM |
I'd imagine it's something similar to OOP.
obj = {["Name"] = "SpecialModel", ["Color"] = BrickColor.new("Bright blue"), ["Struct"] = {["Whatever"] = true, ["WhateverElse"] = false}}
Just my guess, though. The wiki says it's like the 'ResizeableSides' (or whatever), a member of BasePart |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:14 PM |
| If you want me to explain the data structures stated there I can. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2014 02:18 PM |
| So you can't use Struct directly? |
|
|
| Report Abuse |
|
|
| |
|
| |
|