Jump to content

Lua class ?


wh1sp3r
 Share

Recommended Posts

I need a little help with lua :)

 

I am trying to use lua without class, just

 

require("Scripts/core")

function CreateModel(model)
model.light=CreateSpotLight(100)	
end

function Update(model)
model.light:Movef(0,1,0)
end

 

or

 

require("Scripts/core")

light=CreateSpotLight(100)

function Update()
light:Movef(0,1,0)
end

 

Class is a little bit messy in this way, i would like to use lua without it just like that :P

i hope , It's possible ?

-= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=-

Website: http://www.flamewarestudios.com

Link to comment
Share on other sites

Just taking a shot, I think it would be like;

 

function Lights()
 local light = {}
 light.spot = CreateSpotLight(100)

   function light:Update()
     light:Movef(0,1,0)
   end

 return light
end

lights = Lights()
lights:Update()

 

I'm still new to Lua but that's what I've gathered in my day of learning by trial and error. If you mean to automatically update then maybe you'd make it an added hook?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...