Search found 22 matches

by TheBreadCat
Sun Feb 06, 2011 12:54 pm
Forum: General
Topic: bad argument #1 to 'random' (interval is empty)?!?!?
Replies: 10
Views: 7754

Re: bad argument #1 to 'random' (interval is empty)?!?!?

Apparently the math in your call to math.random on line 20 is resulting in a number that's less than one. Make sure it's greater than or equal to 1. but i need a negative value. so do i have to make a if statement to check if the value is negative , and if so then set it to the minimum of the rando...
by TheBreadCat
Sun Feb 06, 2011 10:47 am
Forum: General
Topic: bad argument #1 to 'random' (interval is empty)?!?!?
Replies: 10
Views: 7754

bad argument #1 to 'random' (interval is empty)?!?!?

im making a 1d terrain genarator. but there is a problem: hm = {}--height map hp = {}--height points lp = {}--low points mf = 2--mutate factor function init() math.randomseed( os.time() ) for i = 0 , 9 do hm[i] = {} end for i = 0 , 9 do hm[i] = math.random(0,9) end end init() for i = 0 , 9 do pon = ...
by TheBreadCat
Tue Feb 01, 2011 8:50 am
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: *SOLVED*class problem.

BlackBulletIV wrote:So it was the colon operator issue? Didn't I point that out before? Maybe I wasn't explicit enough.
i had to do some declariations in the init functions.
by TheBreadCat
Fri Jan 28, 2011 7:25 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

attempt to index local 'self'(a nil value) From the code you posted it's hard to tell, but I think you might be calling Update() wrong. A variation of this was pointed out to you earlier many times. I suggest that you read this: colon operator FINALLY thanks all of you! after 2 days i can finally s...
by TheBreadCat
Fri Jan 28, 2011 6:27 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

function love.load() cake = cCake end That won't work. you have to make an instance of cCake: function love.load() cake = cCake:new() end thanks but now there is one problem.. when i to to (ex.) add to varibles of the same instance , ill get an error. function cCake:Update() self.x = self.x + self....
by TheBreadCat
Fri Jan 28, 2011 4:43 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

here you go: __HAS_SECS_COMPATIBLE_CLASSES__ = true local class_mt = {} function class_mt:__index(key) if rawget(self, "__baseclass") then return self.__baseclass[key] end return nil end class = setmetatable({ __baseclass = {} }, class_mt) function class:new(...) local c = {} c.__baseclass...
by TheBreadCat
Fri Jan 28, 2011 4:38 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

are you even listening? What about you, are you listening? I've asked if you could post a .love file that reproduces the problem and you didn't even answer. You won't get much help with this kind of attitude. no i cant post it , its to messed up and i deleted the problem. ill try to make a version ...
by TheBreadCat
Fri Jan 28, 2011 3:09 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

Also, you're creating a global called "instance". This does not seem to have been fixed by anyone. Not the most important of your issues, but still. init() is not called on your class system, but __init() is, which is why it doesn't work. Change either one in the other, and it should work...
by TheBreadCat
Thu Jan 27, 2011 5:17 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

TheBreadCat wrote: still does not work just gets this:

Code: Select all

attempt to perform arithmetic on field 'x'(a nil value)
done before.
just forgot to repost it.
and the __init is changed to init beouse im using http://love2d.org/wiki/Simple_Educative_Class_System.
by TheBreadCat
Thu Jan 27, 2011 5:10 pm
Forum: General
Topic: *SOLVED*class problem.
Replies: 27
Views: 9094

Re: class problem.

it does it must be something else.