Page 1 of 1

LoadModule() is not a function, array, list, map or macro.

Posted: Tue Dec 17, 2024 2:59 pm
by rootuid
I'm trying to run this example code

Code: Select all

If InitSound() = 0
  MessageRequester("Error", "Sound system not available.") : End
EndIf

FileName$ = OpenFileRequester("","","Modules (*.mod, *.xm, *.it)|*.mod;*.xm", 0)
If FileName$
  If LoadModule(0, FileName$)
    PlayModule(0)    
    MessageRequester("PureBasic - Module player", "Playing the module...")
    
    ; Now, perform a nice fading...
    ;
    For k=100 To 0 Step -1
      Delay(20)
      ModuleVolume(0, k)
    Next
    
  Else
    MessageRequester("Error", "Can't load the module or bad module format.")
  EndIf
EndIf
from https://www.purebasic.com/documentation ... le.pb.html

However it fails to compile:
[14:53:08] Waiting for executable to start...
[13:53:08] Executable type: MacOSX - arm64 (64bit, Unicode)
[13:53:08] Executable started.
[14:53:14] The Program execution has finished.
[14:55:50] [COMPILER] Line 8: LoadModule() is not a function, array, list, map or macro.

I'm running PureBasic 6.12 LTS - C Backend (arm64) on Mac.

According to the docs https://www.purebasic.com/documentation ... index.html LoadModule() is valid. Any ideas?

Re: LoadModule() is not a function, array, list, map or macro.

Posted: Tue Dec 17, 2024 3:16 pm
by Quin
You're looking at a very, very old version of the documentation. Note the copyright date at the top of Module.pb.
In version 5.20, with the introduction of modules as a compiler feature, the Module library was renamed to Music. Check the docs for the Music library and all should work :)
- Changed: renamed the whole 'Module' library to 'Music'

Re: LoadModule() is not a function, array, list, map or macro.

Posted: Tue Dec 17, 2024 3:43 pm
by rootuid
Ahhh, thank you.

Not sure how I got to that old documentation.