Page 3 of 3

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 21:54
by zwzsg
abma wrote:@Forb:

its minor because the change is backwards-compatible. if you fix the "n"'s, it will work in the old engine, too.
The engine change is not backward compatible.

However, games can be made forward compatible.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 21:56
by hoijui
the change(s) that have to be done in games are backwards compatible.
it is just a different way of looking at it (engine-change or game-change).

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 21:59
by zwzsg
When they said Windows was backward compatible, then didn't mean every single DOS games had to be remade to work under Windows.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 22:31
by Forboding Angel

Code: Select all

LuaRules\draw.lua                                                    6      if (not arg) then arg = {...}; arg.n = #arg end
LuaRules\Gadgets\LuaCOB.lua                                         46                                  for i = 1, c.n do
LuaRules\Gadgets\lups_flame_jitter.lua                             193        particleList.n = particleCnt
LuaRules\Gadgets\unit_morph.lua                                    486    for i = 2, cmds.n do  -- skip the first command (CMD_MORPH)
LuaRules\Gadgets\customunitshaders\unitmaterials\0_angleshark.lua   18    if (info.n ~= curFrame) then
LuaRules\Gadgets\customunitshaders\unitmaterials\0_angleshark.lua   19      info.n = curFrame;
LuaRules\utilities\json.lua                                        342  -- We consider any table an array if it has indexes 1..n for its n items, and no
LuaUI\Widgets\gui_chiliselections.lua                              896                  selectedUnitsByDef.n     = nil
LuaUI\Widgets\gui_chili_integral_menu.lua                          749          widgetHandler.commands.n = cmdCount
LuaUI\Widgets\unit_group_move.lua                                   29                  if selUnits.n > 1 then
LuaUI\Widgets\unit_healthbars.lua                                  202      for i=1,ud.weapons.n do
LuaUI\Widgets\unit_rangerings.lua                                   67     selUnits.n = nil -- So our loop works
This is my list so far. Of course this doesn't include the [n] stuff, but whatever. Half this shit breaks the moment I touch it.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 22:53
by zwzsg
  • LuraRules\draw.lua 6 if (not arg) then arg = {...}; arg.n = #arg end
    WTF is this if select == nil ?? Doesn't make any sense! I'd say delete it, and see if anything breaks.
  • LuaRules\Gadgets\LuaCOB.lua 46 for i = 1, c.n do
    for i = 1, #c do
  • LuaRules\Gadgets\lups_flame_jitter.lua 193 particleList.n = particleCnt
    Do not touch! This is not an "engine" .n, but a custom one with an entirely different meaning.
  • LuaRules\Gadgets\unit_morph.lua 486 for i = 2, cmds.n do -- skip the first command (CMD_MORPH)
    for i = 2, #cmds do
  • LuaRules\Gadgets\customunitshaders\unitmaterials\0_angleshark.lua 18 if (info.n ~= curFrame) then
    LuaRules\Gadgets\customunitshaders\unitmaterials\0_angleshark.lua 19 info.n = curFrame;
    Custom .n! Do not touch!
  • LuaRules\utilities\json.lua 342 -- We consider any table an array if it has indexes 1..n for its n items, and no
    Uh. This is in a comment. You know what's a comment? Also, if you didn't see it was a comment, use a Notepad++ or any other editor with Lua syntax coloring
  • LuaUI\Widgets\gui_chiliselections.lua 896 selectedUnitsByDef.n = nil
    Remove that line, and below, change:
    or i,v in pairs(selectedUnitsByDef)
    into:
    or i,v in ipairs(selectedUnitsByDef)
  • LuaUI\Widgets\gui_chili_integral_menu.lua 749 widgetHandler.commands.n = cmdCount
    Uh oh, this one is trickier, I'd say leave as.
  • LuaUI\Widgets\unit_group_move.lua 29 if selUnits.n > 1 then
    if #selUnits > 1 then
  • LuaUI\Widgets\unit_healthbars.lua 202 for i=1,ud.weapons.n do
    for i=1,#ud.weapons do
  • LuaUI\Widgets\unit_rangerings.lua 67 selUnits.n = nil -- So our loop works
    Remove that line. Below, change pairs into ipairs

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 23:18
by Forboding Angel
Thank you Z, I very much appreciate it. But I can't help but wonder, how would I have ever fixed that by myself? Pairs? Ipairs? Ipods? Wut?

Just because I can hack away at gadgets and add all kinds of stuff and make them do what I want, doesn't mean I all of a sudden understand the inner workings of lua.

Also, sorry about the comment being left in there, that was an export of results from baregrep.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 23:28
by zwzsg
Forboding Angel wrote:that was an export of results from baregrep.
Notepad++. Search in files. .n Whole word.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 06 Jul 2011, 23:44
by hoijui
zwzsg wrote:When they said Windows was backward compatible, then didn't mean every single DOS games had to be remade to work under Windows.
thing is, nobody said the new spring version would be backwards compatible. in fact, the opposite is implied by the fact that this (and more importantly the other) thread was created.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 07 Jul 2011, 00:18
by jK
nice, but ...
zwzsg wrote:LuraRules\draw.lua 6 if (not arg) then arg = {...}; arg.n = #arg end
WTF is this if select == nil ?? Doesn't make any sense! I'd say delete it, and see if anything breaks.
Bad idea, just keep as is.
zwzsg wrote:LuaUI\Widgets\gui_chiliselections.lua 896 selectedUnitsByDef.n = nil
Remove that line, and below, change:
or i,v in pairs(selectedUnitsByDef)
into:
or i,v in ipairs(selectedUnitsByDef)
Again no change required.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 08 Jul 2011, 03:06
by Forboding Angel
On the subject of being a broken record...

I read somewhere in this thread to look for [n] as well. What about these?

*snipped*

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 08 Jul 2011, 03:20
by jK
Forboding Angel wrote:On the subject of being a broken record...

I read somewhere in this thread to look for [n] as well. What about these?
Totally unrelated.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 08 Jul 2011, 03:29
by smoth
are you getting errors about them? if so look into it. if not it is fine and unrelated.

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 08 Jul 2011, 03:33
by Forboding Angel
Nope, not that I can tell. Seems to work ok. Groupmove still isn't working right, but that's fairly minor I think.

So many bugs :-/

or wait, oh I'm prolly testing with an old as 83 (it';s what abma told me to use to test this .n stuff). That would explain a heck of a lot.

Also, on some of my beam weapon emits a random ceg is being fired :-/ Maybe it has a hit ceg defined... looking... Yep, it does. So ok, that's a game bug then (technically it's an engine bug tho because only the glow is emitted, the beam is never actually fired, but, semantics... Easy enough to fix on my end.

I despise mantis... Can I post bugs elsewhere? (Like help and bugs forum?)

Re: To Game-Devs: The "n" entry in array-like tables was removed

Posted: 08 Jul 2011, 03:41
by jK
if at all you should need to look for ["n"]. but it's such a strange syntax, so I don't think anyone ever used it in a dangerous way.