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

Just starting out? Need help? Post your questions and find answers here.
rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

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

Post 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?
Quin
Addict
Addict
Posts: 1134
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

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

Post 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'
rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

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

Post by rootuid »

Ahhh, thank you.

Not sure how I got to that old documentation.
Post Reply