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

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

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

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

Post 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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

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

Post 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).
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

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

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

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

Post 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
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

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

Post by zwzsg »

Forboding Angel wrote:that was an export of results from baregrep.
Notepad++. Search in files. .n Whole word.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

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

Post 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.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

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

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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*
Last edited by Forboding Angel on 08 Jul 2011, 03:29, edited 1 time in total.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

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

Post 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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

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

Post by smoth »

are you getting errors about them? if so look into it. if not it is fine and unrelated.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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?)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

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

Post 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.
Post Reply

Return to “Game Development”