Another example of a meaningless annoying bug
#1
Line 3: [lua] local controller = body.VelocityController [/lua]
--Some stuff


Line 14: [lua] function CheckVitalSigns() [/lua]
--Some stuff


Lines 17-20: [lua] if controller == nil then
controller = create("VelocityController")
controller.Parent = body
end [/lua]
--More stuff, including end of CheckVitalSigns


Lines 30-32: [lua]while true do
sleep(0.1)
CheckVitalSigns() [/lua]
--Even more stuff


Lines 46-48: [lua] if not controller then CheckVitalSigns() end
if thedude.Position.x > body.Position.x then
controller.Velocity.x = 5.0 [/lua]

Output: Script:48: attempted index of non-table

>Sad
Reply
#2
controller.Velocity.x = 5.0


Have you tried "controller.Velocity = Vec2D(5.0,0)" and you can change the y-component to whatever you want.
Reply
#3
I'll try -- using it like this:
[lua]
controller.Velocity = Vec2D(5.0,controller.Velocity.y)
[/lua]
So that I can change the y seperately.

And it worked. :doubt: Vectors are odd in Lua.
Reply
#4
You can't only change the x or y components.
Reply
#5
^^ Err, I mean change their values.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)