Maths Functions

Latest Information on Sim Innovation's flagship product Air Manager

Moderators: russ, Ralph

Message
Author
AnthonySullivan
Posts: 91
Joined: Wed Jul 01, 2020 8:06 am

Maths Functions

#1 Post by AnthonySullivan »

Gentlemen

When I look on the net I find some math functions but they do not all work on Air Manager.

A list of the maths.### functions that work on Air Manager would be very helpful.

I have had a search on the Wiki but failed to find a list.

Would you be able to provide one or tell me where I might find it?

Many thanks
Anthony Sullivan

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Maths Functions

#2 Post by JackZ »

I guess it is related to the current version of Lua that Air Manager uses. Some maths functions have changed overtime (after Lua 5.0) and the websites are not always up to par with the latest version of Lua currently in 5.3x IIRC (5.4 being a bug fix version)


I think that AM uses Lua JiT as a compiler, and I guess it’s already in 5.3 but Corjan will confirm it.
For current language implementation always refer to Lua.org

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Maths Functions

#3 Post by Ralph »

That's correct. As Jacques already mentioned, a lot of Lua functions got deprecated and were replaced.
https://www.lua.org/manual/5.3/

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Maths Functions

#4 Post by jph »

Excellent info guys.
If I have missed it - I apologise, but if not, please spell this out (the version to refer to) somewhere prominent on the main pages.
Thanks
Joe
Joe. CISSP, MSc.

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Maths Functions

#5 Post by JackZ »

The current maths functions list is here FYI.
https://www.lua.org/manual/5.3/manual.html#6.7

Note that not ALL the Lua functions are implemented in AM, namely I think that all the io and file manipulation functions are disabled. Most probably as well the OS related functions, as they are OS specific as the name implies.
Have never tried these, but I doubt that all the debug library functions were implemented as well.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: Maths Functions

#6 Post by Tetrachromat »

The 'package' library is also not available. Would be nice to have that to better organize common code in modules.

Don't know why that was excluded.

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Maths Functions

#7 Post by Corjan »

Hi,


It is to prevent using absolute paths or OS/platform specific libraries that might break compatibility with other platforms.

There is a proper way to use common code:
http://siminnovations.com/wiki/index.ph ... _libraries


Corjan

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Maths Functions

#8 Post by Keith Baxter »

Corjan wrote: Mon Jun 28, 2021 6:38 pm Hi,


It is to prevent using absolute paths or OS/platform specific libraries that might break compatibility with other platforms.

There is a proper way to use common code:
http://siminnovations.com/wiki/index.ph ... _libraries


Corjan
Hi,

I use library's extensively and did not know you can make them visible or not.

This brings about a question
Is a xxx_init() a node.

In other words can I do this?

Code: Select all

---Place a empty group_add before initializing all the inits in the logic.lua or another init.
my_init_group=group_add()

---initialize the inits
my_lib_2_init()
my_lib_3_init()
my_lib_4_init()

---somewhere in code add the init nodes to a group
group_obj_add(my_init_group,my_lib_2_init(),my_lib_3_init(),my_lib_4_init()

---then make the group visible or not.

visible(my_init_group,false)


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Maths Functions

#9 Post by Keith Baxter »

Hi,

Obviously one can have more that one init() in a library.

If the ^ post is not possible. Can I create an init with all the inits.

Code: Select all


--In the logic.lua
master_init()


function master_init()

---initialize the inits
  my_lib_2_init()
  my_lib_3_init()
  my_lib_4_init()
end


visible(master_init(),false)

Would that make all the other inits in the master init also not visible?

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Maths Functions

#10 Post by Corjan »

Hi,


Node that the my_lib_1_init() function is nothing special, it is a regular lua function.
The wiki page describes a way you could organize your libraries.

So doing 'visible(master_init(),false)' will fail since the master_init won't return a value, but will return nil instead by lua standards.
And the visible function won't accept a nil for its first argument.

You could let the my_lib_1_init() return a group, that one you can use with the visible function.


Corjan

Post Reply