Blue Solitare Posted February 13, 2010 Posted February 13, 2010 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 Quote
macklebee Posted February 13, 2010 Posted February 13, 2010 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. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Blue Solitare Posted February 16, 2010 Author Posted February 16, 2010 Sorry for the delayed response to yours: ... create a source ... That was this missing bit. Thanks for your help. Quote
macklebee Posted February 16, 2010 Posted February 16, 2010 no problem glad to help. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Recommended Posts
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.