Jump to content

GetSourceState and Lua??


Blue Solitare
 Share

Recommended Posts

Hello,

 

function class:CreateObject(model)
local object=self.super:CreateObject(model)

...

  function object:Init()
     class.sound=LoadSound('abstract::sound1.wav')
  end

...

  function object:Update()
     value = object.model:GetSourceState(class.sound)
  end
end

 

When I try to run the script I get "Index for object is not a valid field or method". According to documentation, GetSourceState will return the enumeration SourceState::Stopped/Playing/Paused.

 

I've tried "tonumber", with no success. How do you deal with enumerations in Lua?

 

Thanks,

 

Blue

Link to comment
Share on other sites

The problem is not the enumeration but the fact you are trying to determine the source state from something other than a source. You need to load a sound, create a source, play the source, then check the state of the source.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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...