|
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Author |
Message |
AaronLee
Joined: Fri Jun 01, 2007 12:17 am Posts: 106
|
Passing MO pointers
Hi all, I hate to join the 1,000 other poor sods with LUA issues, but I'm getting some rather obscure problems with my current attempt to do something interesting with LUA.
Simply; I've already figured out how to 'attach' one actor to another. That is, I have coding for spatial positioning and the like and I can also attach these actors manually (but through a lot of code.)
I've been trying to sidestep that coding by making a nice, standalone lua file that essentially, given a parent actor to attach to, allows another actor to stay 'attached.' That's not really the problem. My issue is I'm trying to pass a pointer to that child object so it can get information from the parent.
Layman's terms... as I can best manage; the child object has a variable that SHOULD let it look at the parent's varialbes (like positrion, rotation, etc) I'm instead assigning it a nil value for some reason.
Anyway, I have a C++ background so this may make more sense to some than to others, sorry. Hopefully I'm not at the tip of this push into LUA, otherwise I'm going to need some help from on high on what the CreateACrab function returns and how I can get that from an object's own create and update functions. Otherwise I'm high and dry.
Mod with coding is attached, PLEASE don't copypasta it for your own purposes without my permission.
|
Sat May 23, 2009 6:06 am |
|
|
AaronLee
Joined: Fri Jun 01, 2007 12:17 am Posts: 106
|
Re: Passing MO pointers
Kind of unrelated, but why does THIS not work? Code: self.offset1 = self.Offset1.RadRotate(self.RotAngle);
|
Sat May 23, 2009 7:40 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Passing MO pointers
cause your capitalisation is wrong. self.offset1 = self.offset1.RadRotate(self.RotAngle);
|
Sat May 23, 2009 7:47 am |
|
|
AaronLee
Joined: Fri Jun 01, 2007 12:17 am Posts: 106
|
Re: Passing MO pointers
Yeah, that would be aproblem. But, more importantly, it's askign for an argument of type "custom[float]" instead of what I gave ("number") which baffles me as the number given is a float (RotAngle) not sure at all what that's about.
|
Sat May 23, 2009 9:46 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Passing MO pointers
oh. and it should probably be a function. self.offset1 = self.offset1:RadRotate(self.RotAngle);
|
Sat May 23, 2009 11:14 pm |
|
|
alfie275
Joined: Sun May 18, 2008 7:49 am Posts: 23
|
Re: Passing MO pointers
No using ':' passes the vector as an argument to the function, use '.'. But how to convert from 'number' to 'custom [float]'? It is halting progress on my homing gatling gun.
|
Sun May 24, 2009 1:47 pm |
|
|
piipu
Joined: Mon Jun 30, 2008 9:13 pm Posts: 499 Location: Finland
|
Re: Passing MO pointers
In luaguns there's a dummy dropship with turrets attached that work the way you want this to work. Look at the code for help.
|
Sun May 24, 2009 2:13 pm |
|
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|