Author Topic: A few more lua functions  (Read 837 times)

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
A few more lua functions
« on: 5 January 2012, 00:59:55 »
By request from Muwuum I've added a few more lua methods:

Code: [Select]
string getSystemMacroValue(string key)
string getPlayerName(int factionIndex);
The first function will be expanded as time goes on, but for now it allows you to get the path to the loaded scenario, example:

Code: [Select]
dofile(getSystemMacroValue("$SCENARIO_PATH") .. "startup.lua")
The second returns the playername for the given faction index example:

Code: [Select]
getPlayerName(0)
would return the playername for player in the first faction. This would be useful for network scenarios. This is in svn and would be included in the next release.

Thanks


MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: A few more lua functions
« Reply #1 on: 5 January 2012, 01:08:41 »
I will do the documentation on the wiki.

But it's MuwuM (or short: "Move"):
Muwuum

Out of Topic:
"muwum" is a Jingulu-word which means: "be dark". I have choosen this Nickname because it is symmetrical.


Edit: Documentation is done.

Edit2:
     Just noticed that GAE has comparable methods so we maybe should support theirs as alias.
     It would be playerName() and scenarioDir().
Edit3:
     I created the alias-methods. Patch-file: http://www.muwum-lexicons.de/patch-for-3042-lua-alias.patch
« Last Edit: 5 January 2012, 15:26:58 by MuwuM »

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: A few more lua functions
« Reply #2 on: 5 January 2012, 20:02:03 »
Patch applied in svn.