generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Table returns as nil

Previous Thread :: Next Thread 
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
01 Nov 2015 11:19 PM
stuff
local Chars = require(game.ReplicatedStorage.Chars)
stuff
local char = Chars.GetChar(char)
if char[1] ~= nil then <- source of error

Example = {"Example","Example","Example}

function Chars.GetChar(char)
return char
end

I might just be doing something stupid because I'm tired. oh man i am not good with computer plz to halp
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Nov 2015 11:20 PM
because Chars.GetChar(char) is returning nil.
Report Abuse
PvN is not online. PvN
Joined: 10 Apr 2010
Total Posts: 22145
01 Nov 2015 11:21 PM
hahaha what are doing
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
01 Nov 2015 11:24 PM
Example = {"Example","Example","Example} should be Example = {"Example","Example","Example"}, it's not the source of the error
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
01 Nov 2015 11:27 PM
Let me start over I am half alseep right now why am i trying to script

Text module:

stuff
local Chars = require(game.ReplicatedStorage.Chars)
stuff
local char = Chars.GetChar(char)
if char[1] ~= nil then <- source of error

Chars Module:

Example = {"Example","Example","Example"}

function Chars.GetChar(char)
return char
end

Test script:

local Text = require(game.ReplicatedStorage.Text)
Text.PrintText(Example,"Hi")
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
01 Nov 2015 11:28 PM
Error is

23:27:25.143 - ReplicatedStorage.Text:24: bad argument #3 to 'Text' (string expected, got nil)
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
01 Nov 2015 11:32 PM
Okay this is supposed to return a table:

Example = {"Example","Example","Example}

function Chars.GetChar(char)
return char
end

what amI doing wrong
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Nov 2015 11:33 PM
Okay 'local char = Chars.GetChar(char)' at that point char is nil (unless it's part of the "stuff")
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image