Jump to content


Luca_S

Member Since 09 Nov 2014
Offline Last Active Yesterday, 05:33 PM
*****

Posts I've Made

In Topic: Can't figure out what is deleting my table

20 August 2019 - 05:27 AM

See here.

A table in Lua is only a reference, like objects in Java. This means that any changes you do to the parameter in the highScore function as a side effect changes the original value.
If you really want to copy a table instead of doing
pTab = tab
you need to use something like this function:
function copyTable(src, dest)
  dest = {}
  for k, v in pairs(src) do
	if type(v) ~= "table" then
	  dest[k] = v
	else
	  dest[k] = {}
	  copyTable(v, dest[k])
	end
  end
end

Also you could just sort the scores table like this:
table.sort(scores, function(a, B)/> return a.score > b.score end)

If you use that in the highScore function that will of course as a side effect sort the "t" table. But if the original order of the scores doesn't matter you can just do it like this. Else you need to first copy the table using the function above and then sort the new table.

In Topic: Ramuthra's Plane

09 June 2019 - 07:32 AM

Are you aware that you can softlock yourself in level 2?

Posted Image

In Topic: Global Programs / APIs

02 June 2019 - 04:48 AM

View PostEveryOS, on 31 May 2019 - 02:30 PM, said:

shell.setPath(shell.path()..";myPrograms/;")

According to the wiki the separator is ":", the path should be absolute and the trailing slash can be removed(I would suggest doing so to keep to the style of the existing path). Also the existing path does not end with a column, so neither should the new one:
shell.setPath(shell.path()..":/myPrograms")

In Topic: The ban game

27 May 2019 - 07:33 AM

Banned for not using https. Also sign up still isn't fixed.

OpenComputers.

In Topic: Is there any way to load code onto command computers in survival?

20 May 2019 - 06:31 PM

IIRC you can give yourself a computer with a certain damage value to have it have a specific ID, however I'm not sure if that is still possible and if that falls under data tags.(I know in older Versions of MC you could do /give <player> <id>:<damage>)