Jump to content


Luca_S

Member Since 09 Nov 2014
Offline Last Active Nov 04 2019 08:18 AM
*****

Posts I've Made

In Topic: Return/break commands not working? [1.12.2]

02 November 2019 - 08:09 PM

Quote

As the return needs to be the last statement in a block Lua is going to interpret
  return
  print(stuck)
end
As returning the return value of print(stuck), which means print(stuck) is executed again.
Other than that I see no reason why the return shouldn't work, please post your whole code.

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)
  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.