The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

differences between "normal" lua and dg lua

By on November 25, 2009 8:13:26 PM from Demigod Forums Demigod Forums

i would like to create a list of differences between normal lua and demigods lua. so if you find something that doesnt work though it should or the other way around, post it here!

+4 Karma | 7 Replies
November 25, 2009 11:20:36 PM from Demigod Forums Demigod Forums

I don't know if this is quite what you're looking for, but I think it might be useful.

I found a Lua script for finding global functions at http://www.wowwiki.com/User:Mikk/Scripts. After a few modifications I was able to call it from a Demigod mod and log the results.

Here's the script I used:

Code: javascript
  1. local function getcfunclist()
  2.  local res = {}
  3.  for k,v in pairs(_G) do
  4.   if type(v) == "cfunction" then
  5.    table.insert(res, k);
  6.   end
  7.  end
  8.  table.sort(res);
  9.  local str = table.concat(res, "\n");
  10.  LOG('CFUNCTIONS:  ', str);
  11. end

And the results are at http://www.arguingwithmyself.com/files/demigod%20cfunctions.txt.  Some of the functions listed I've seen in Demigod Lua - like GetArmiesTable in HUD_scoreboard.lua and GetCamera in bman's partyPanel.lua.  Unfortunately since I'm new to Lua I haven't found a way to get each function's parameters so I don't know how to actually call them.  Maybe an experienced Lua coder can figure that out.

Hope this helps.

November 26, 2009 12:25:05 AM from Demigod Forums Demigod Forums

once you have a function name, use WinGrep to search for that function in all the LUA and you'll usually find some place where it is being used and/or defined and so can infer the functions.  Maybe a LUA expert can give you a better way though

One good method I found was repr(anyvariable) which will dump the contents of the variable/table/object whatever.  I suppose you could pass it a function and see what it dumps out about it?

November 26, 2009 3:02:57 AM from Demigod Forums Demigod Forums

Demigod lua uses '#' for comment. Normal lua uses this character to get length of a table.

'import' statement is not in normal lua too.

November 26, 2009 12:50:56 PM from Demigod Forums Demigod Forums

Also, Demigod lua supports the continue statement.

November 26, 2009 11:26:48 PM from Demigod Forums Demigod Forums

^^^ yeah that's one of the ones I noticed.

November 27, 2009 2:00:29 PM from Demigod Forums Demigod Forums

Use LUADOC console command to get a list of engine functions.

"import" is not a statement, it's a function.

 

Basically, the lua core is LuaPlus, so most of the changes:

  • ~= as well as !=
  • # and -- for comments
  • no need to use an iterator on a table in "for k, v in table do" construct
  • continue

... and all the other 'improvements' provided by LuaPlus. Though it uses lua 5.0 as a base, so there are couple of annoying bugs.
Also, the lua bytecode isn't compatible with any LuaPlus / vanilla lua versions. ( obviously, gpg modified luaplus )

November 28, 2009 12:11:46 AM from Demigod Forums Demigod Forums

Demigod uses Lua 5.0 as a base?

I thought it used an earlier version

Stardock Forums v1.0.0.0    #108434  walnut1   Server Load Time: 00:00:00.0000125   Page Render Time:

Stardock Magazine | Register | Online Privacy Policy | Terms of Use

Copyright ?? 2012 Stardock Entertainment and Gas Powered Games. Demigod is a trademark of Gas Powered Games. All rights reserved. All other trademarks and copyrights are the properties of their respective owners. Windows, the Windows Vista Start button and Xbox 360 are trademarks of the Microsoft group of companies, and 'Games for Windows' and the Windows Vista Start button logo are used under license from Microsoft. ?? 2012 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.