Simple Lua Request, Like this is so simple that you could help me!
8 replies, posted
So I am working on making a bunch of really useful expression 2 commands but I don't know how to use variables other than numbers or entities for my commands.......
example:
[lua]
e2function void entity:setPlayerPos( x, y, z )
if !this:IsPlayer() then return end
this:SetPos( Vector( x, y, z ) )
end
[/lua]
I would really like to be able to just do
[lua]
e2function void entity:setPlayPos( vec )
if !this:IsPlayer() then return end
this:SetPos( vec )
end
[/lua]
I would love to be able to do this with vectors strings and angles.
Thanks in advance!
EDIT: Read bottom for how I found how to fix this
Inb4wrongsection
[highlight](User was banned for this post ("Meme reply / backseat mod" - Craptasket))[/highlight]
which section should I put it in?
(should be in developer discussion)
can I move it? idk how
And use [lua] [/lua] tags round code ;)
[editline]13th May 2013[/editline]
Er ask a mod
[editline]13th May 2013[/editline]
The tags for code are [.lua] and to close [./lua] (NO DOTS)
[editline]13th May 2013[/editline]
Sorry about not actually being able to help, just stopping you being banned for wrong section :)
lol thanks anyways
No problem ;)
Well for anyone who might happen upon this thread with the same problem I had this is how I fixed it
[lua]
e2function void entity:setPlayerPos( vector vec )
if !this:IsPlayer() then return end
local telePos = Vector( vec[1], vec[2], vec[3] )
this:SetPos( telePos )
end
[/lua]
Doing this lets me input a vector for my E2 function
Sorry, you need to Log In to post a reply to this thread.