Jump to content




Error I cannot understand.


  • You cannot reply to this topic
35 replies to this topic

#21 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 07 October 2012 - 03:54 AM

It's actually both. You can call functions inside tables with colons and periods - the combination in which they are defined and called usually depends on if the user wants to use the "self" keyword.

In this case though, you can do both without any problems (I think).

#22 Watcher7

  • Members
  • 25 posts
  • LocationEquestria, TX

Posted 07 October 2012 - 03:56 AM

Also, please learn to indent your code with atleast 2 spaces (4 spaces or 1 tab is more common) per block, otherwise people can't read large scripts you make and you might get lost in your own code (and get laughed at by less understanding programmers).

Example of indentation:
local indentation = {}

function indentation.example()
	local correct = true
	if correct then
		for counter = 1, 10 do
			print('This is an example of "correct" indentation.')
		end
	end
end

indentation.example()


#23 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 03:58 AM

View Postluanub, on 07 October 2012 - 03:53 AM, said:

Not in the case of the fs api.

A good tutorial on using fs is here
Both ways work, that is currently not my problem atm. Look above. EDIT: Last Page


EDIT: Ninja'd

View PostWatcher7, on 07 October 2012 - 03:56 AM, said:

Also, please learn to indent your code with atleast 2 spaces (4 spaces or 1 tab is more common) per block, otherwise people can't read large scripts you make and you might get lost in your own code (and get laughed at by less understanding programmers).

Example of indentation:
local indentation = {}

function indentation.example()
	local correct = true
	if correct then
		for counter = 1, 10 do
			print('This is an example of "correct" indentation.')
		end
	end
end

indentation.example()

I know, my code looks horrible, but the reason I don't is cause I think it's wasting time.

#24 Watcher7

  • Members
  • 25 posts
  • LocationEquestria, TX

Posted 07 October 2012 - 04:01 AM

View Postbrett122798, on 07 October 2012 - 03:58 AM, said:

View Postluanub, on 07 October 2012 - 03:53 AM, said:

Not in the case of the fs api.

A good tutorial on using fs is here
Both ways work, that is currently not my problem atm. Look above. EDIT: Last Page


EDIT: Ninja'd

View PostWatcher7, on 07 October 2012 - 03:56 AM, said:

Also, please learn to indent your code with atleast 2 spaces (4 spaces or 1 tab is more common) per block, otherwise people can't read large scripts you make and you might get lost in your own code (and get laughed at by less understanding programmers).

Example of indentation:
local indentation = {}

function indentation.example()
	local correct = true
	if correct then
		for counter = 1, 10 do
			print('This is an example of "correct" indentation.')
		end
	end
end

indentation.example()

I know, my code looks horrible, but the reason I don't is cause I think it's wasting time.
Hitting the tab key isn't that hard nor is it time consuming.

#25 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 04:05 AM

View PostWatcher7, on 07 October 2012 - 04:01 AM, said:

Hitting the tab key isn't that hard.
You cannot tab on CC computers, and half my code was done on one.

#26 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 07 October 2012 - 04:09 AM

Try using io.open() and the just file:read() and see what that does. Since your storing a single word string in the file it should properly read it.

Other things to check:
What do the contents of the file look like after the write?
You can also do something like this to check what the variable type is:
sType = type(newusername)
print(sType)
Do the same thing for username.
Also print them on the screen when they are being written or read so that you can see what it is doing. That should give you an idea as to what is going wrong.

#27 chiloxsan

  • Members
  • 56 posts
  • LocationVictoria, AUS

Posted 07 October 2012 - 04:09 AM

View Postbrett122798, on 07 October 2012 - 04:05 AM, said:

View PostWatcher7, on 07 October 2012 - 04:01 AM, said:

Hitting the tab key isn't that hard.
You cannot tab on CC computers, and half my code was done on one.

If you are playing any version under 1.4 (such as the version that is included on Tekkit), the text editor does not tab. Any version above and when you hit tab the line is indented by 2 spaces.

#28 Watcher7

  • Members
  • 25 posts
  • LocationEquestria, TX

Posted 07 October 2012 - 04:12 AM

View Postbrett122798, on 07 October 2012 - 04:05 AM, said:

View PostWatcher7, on 07 October 2012 - 04:01 AM, said:

Hitting the tab key isn't that hard.
You cannot tab on CC computers, and half my code was done on one.
But CC is now able to pull from your clip-board, you should not be doing anything but quick edits in-game with edit. All your work should be done outside in your editor/IDE of choice and transfered over (or edited directly if the files are local).

#29 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 04:20 AM

View Postchiloxsan, on 07 October 2012 - 04:09 AM, said:

View Postbrett122798, on 07 October 2012 - 04:05 AM, said:

View PostWatcher7, on 07 October 2012 - 04:01 AM, said:

Hitting the tab key isn't that hard.
You cannot tab on CC computers, and half my code was done on one.

If you are playing any version under 1.4 (such as the version that is included on Tekkit), the text editor does not tab. Any version above and when you hit tab the line is indented by 2 spaces.
I'm probably gonna get flamed for this, but, I'm never updating to 1.3 or anything above, I'm sick of the horrible updates. So there is no way I'll get that feature.

#30 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 04:23 AM

View Postluanub, on 07 October 2012 - 04:09 AM, said:

Try using io.open() and the just file:read() and see what that does. Since your storing a single word string in the file it should properly read it.

Other things to check:
What do the contents of the file look like after the write?
You can also do something like this to check what the variable type is:
sType = type(newusername)
print(sType)
Do the same thing for username.
Also print them on the screen when they are being written or read so that you can see what it is doing. That should give you an idea as to what is going wrong.
Hey, thanks. io.open worked! Time to move on and get more annoying errors!

#31 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 07 October 2012 - 04:23 AM

So I tested it and the contents of the file are "table: 73424782".

Even though the var username was correct and was a string.

So I changed your :'s to .'s and it works like a charm. As I said before with fs you need .'s not :'s.... You're error will go away if you replace them.

EDIT:Changing to io works too since it uses :'s that you have in the code.

Edited by luanub, 07 October 2012 - 04:24 AM.


#32 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 07 October 2012 - 08:21 AM

I bet you're one of those kind of people who complain if updates don't happen and also if they do.

I'm curious, what makes 1.3.2 a horrible update?

#33 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 07 October 2012 - 08:43 AM

View PostWatcher7, on 07 October 2012 - 04:12 AM, said:

View Postbrett122798, on 07 October 2012 - 04:05 AM, said:

View PostWatcher7, on 07 October 2012 - 04:01 AM, said:

Hitting the tab key isn't that hard.
You cannot tab on CC computers, and half my code was done on one.
But CC is now able to pull from your clip-board, you should not be doing anything but quick edits in-game with edit. All your work should be done outside in your editor/IDE of choice and transfered over (or edited directly if the files are local).

Actually when you paste from your clipboard in cc, it only pastes 1 line of your clipboard. Unless your program is one line, it's pretty much useless to copy and paste. Also since CTRL is the key to open the edit menu, it kinda stuffs up.

#34 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 08:51 AM

View PostCloudy, on 07 October 2012 - 08:21 AM, said:

I bet you're one of those kind of people who complain if updates don't happen and also if they do.

I'm curious, what makes 1.3.2 a horrible update?
No, I like updates not to come, unless they're good. They also cause to have modders to update their mods, and stuff like that.

All updates have had something bad ever since Beta 1.8(which is what I call "The Death Update"). 1.3 just had so many poor changes since it took like 3+ months to update, and very little good. About all changes that were made were bad because I say "If it's fixed, don't try to fix it and end up breaking it." Most additions in 1.3 I just plain didn't like except like the ender chest. Oh, and 1.4 is just as bad too. Sorry, I come from alpha(probably you too) when things were simple, yet more fun.

#35 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 07 October 2012 - 09:16 AM

1.3 was a necessary rewrite to allow the modding API. Well worth it in the long run. I'm from alpha too - but I like the changes - I guess that's where we differ - but I'm off topic - bad Cloudy!

#36 brett122798

  • Members
  • 300 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 07 October 2012 - 09:47 AM

View PostCloudy, on 07 October 2012 - 09:16 AM, said:

1.3 was a necessary rewrite to allow the modding API. Well worth it in the long run. I'm from alpha too - but I like the changes - I guess that's where we differ - but I'm off topic - bad Cloudy!
Are the clouds gonna be mad at you now? J:

Did I hear thunder?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users