Difference between revisions of "Talk:SCO"

From GTAMods Wiki
Jump to navigation Jump to search
(Difference Between 'Local' variables and 'Global' variables: new section)
Line 3: Line 3:
 
::Well, since they only seem to be used as function parameters, there is no real point in popping them from the stack (since called functions do that internally), is there? Although, how are return values handled? Can there be multiple return values? --[[User:Steve-m|Steve-m]] 00:48, 6 February 2009 (UTC)
 
::Well, since they only seem to be used as function parameters, there is no real point in popping them from the stack (since called functions do that internally), is there? Although, how are return values handled? Can there be multiple return values? --[[User:Steve-m|Steve-m]] 00:48, 6 February 2009 (UTC)
 
:::Steve I don't think there are multiple return values. CallNative opcode has a parameter that specifies the outputs generated by the native, but that seems to be only 0 and 1. Of course you can always create a structure then output a pointer like in C++. --[[User:Sacky|Sacky]]
 
:::Steve I don't think there are multiple return values. CallNative opcode has a parameter that specifies the outputs generated by the native, but that seems to be only 0 and 1. Of course you can always create a structure then output a pointer like in C++. --[[User:Sacky|Sacky]]
 +
 +
== Difference Between 'Local' variables and 'Global' variables ==
 +
 +
Does anyone know it? The only difference I could possibly see between them is a public declaration in the script so other scripts could access it... I don't see how local variables are even used when function locals are supported.

Revision as of 02:11, 14 February 2009

Maybe it is a silly question, but if there is a push onto the stack, how the numbers are pop'ed back? Since SCO seems to be similar to ASM (I have not yet took a look to scripts, only to this article) I think it is worth to mention this in the article (if there is an awnser, what I hope ^^). --Aschratt 20:17, 5 February 2009 (UTC)

The list of opcodes is incomplete, there are ones that pop numbers back.Seemann 00:05, 6 February 2009 (UTC)
Well, since they only seem to be used as function parameters, there is no real point in popping them from the stack (since called functions do that internally), is there? Although, how are return values handled? Can there be multiple return values? --Steve-m 00:48, 6 February 2009 (UTC)
Steve I don't think there are multiple return values. CallNative opcode has a parameter that specifies the outputs generated by the native, but that seems to be only 0 and 1. Of course you can always create a structure then output a pointer like in C++. --Sacky

Difference Between 'Local' variables and 'Global' variables

Does anyone know it? The only difference I could possibly see between them is a public declaration in the script so other scripts could access it... I don't see how local variables are even used when function locals are supported.