[Linux]Getting any background value from the computer?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Linux]Getting any background value from the computer?
What function in lua allows to get specific value from the memory address?
Re: [Linux]Getting any background value from the computer?
I don't think there's a way to do that... What do you want to achieve exactly? Why do you need such a possibly generic value?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: [Linux]Getting any background value from the computer?
Long rant incoming.
<rant length="long">
Yeah you should never need that... but if you REALLY need it... you could make a c library. I think you are trying to access a value across separately run binaries/applications. If this is what you are trying to do it will never work. The x86 and x86_64 processors are built so that this isn't really possible. (The OS can do some cool stuff to make it work anyway though like windows did to allow 16bit programs to run even in windows vista.)
But keep in mind that a pointer in one application NOT pointing to the same value in another application. This is intentional in Linux. For every single memory call Linux internally redirects the processor to where the memory actually is. So the pointer 0x12345678 doesn't actually point to that location. The location that this pointer will point to it unique to the application running and will actually represent memory somewhere else (such as at 0x87654321).
In a nutshell, applications are sandboxed. This is for a good reason because now it is theoretically possible to make an OS that cannot crash. (that doesn't happen in practice though of course) Now a misbehaving application doesn't cause a blue screen of death (or a kernel panic).
Lastly, even if it is possible. It is a REALLY, REALLY, REALLY bad idea. There are solid standards for sharing memory between applications that have been around for a long time now.
</rant>
<rant length="long">
Yeah you should never need that... but if you REALLY need it... you could make a c library. I think you are trying to access a value across separately run binaries/applications. If this is what you are trying to do it will never work. The x86 and x86_64 processors are built so that this isn't really possible. (The OS can do some cool stuff to make it work anyway though like windows did to allow 16bit programs to run even in windows vista.)
But keep in mind that a pointer in one application NOT pointing to the same value in another application. This is intentional in Linux. For every single memory call Linux internally redirects the processor to where the memory actually is. So the pointer 0x12345678 doesn't actually point to that location. The location that this pointer will point to it unique to the application running and will actually represent memory somewhere else (such as at 0x87654321).
In a nutshell, applications are sandboxed. This is for a good reason because now it is theoretically possible to make an OS that cannot crash. (that doesn't happen in practice though of course) Now a misbehaving application doesn't cause a blue screen of death (or a kernel panic).
Lastly, even if it is possible. It is a REALLY, REALLY, REALLY bad idea. There are solid standards for sharing memory between applications that have been around for a long time now.
</rant>
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Re: [Linux]Getting any background value from the computer?
I'm assuming he's asking for an environment variable, since getting a memory address would be the most useless thing in the world. For that you'd want to learn about os.execute and shell scripting (probably BASH).
Re: [Linux]Getting any background value from the computer?
You can get an environment variable using os.getenv I think
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: [Linux]Getting any background value from the computer?
That might be it but he is asking "value from the memory address"... I am not sure how that is an environment variable...
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Re: [Linux]Getting any background value from the computer?
Environment variables are stored in a specific memory position, in C getenv (?) returns a pointer. I'd guess he thinks it's the same in Lua.I~=Spam wrote:That might be it but he is asking "value from the memory address"... I am not sure how that is an environment variable...
Re: [Linux]Getting any background value from the computer?
Yes the variables must be stored somewhere... and strings are arrays of characters which is accessed by a pointer. In lua strings are not pointers because the interface is abstracted away. If he wanted the string I think he would have asked for a string not a value at an address. Why would he ask for the value at an address unless he already had an address in mind? No lua function returns a raw address. So he must have been trying to do something he shouldn't.S0lll0s wrote:Environment variables are stored in a specific memory position, in C getenv (?) returns a pointer. I'd guess he thinks it's the same in Lua.I~=Spam wrote:That might be it but he is asking "value from the memory address"... I am not sure how that is an environment variable...
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Re: [Linux]Getting any background value from the computer?
We both know all that, but I'm guessing he barely knows Lua, heard specifically about pointers with getenv and doesn't know how to translate that into Lua, which I bet he is also relatively new too.I~=Spam wrote:Yes the variables must be stored somewhere... and strings are arrays of characters which is accessed by a pointer. In lua strings are not pointers because the interface is abstracted away. If he wanted the string I think he would have asked for a string not a value at an address. Why would he ask for the value at an address unless he already had an address in mind? No lua function returns a raw address. So he must have been trying to do something he shouldn't.S0lll0s wrote:Environment variables are stored in a specific memory position, in C getenv (?) returns a pointer. I'd guess he thinks it's the same in Lua.I~=Spam wrote:That might be it but he is asking "value from the memory address"... I am not sure how that is an environment variable...
Re: [Linux]Getting any background value from the computer?
Maybe.... It would be nice if he posted and clarified.... :\S0lll0s wrote:We both know all that, but I'm guessing he barely knows Lua, heard specifically about pointers with getenv and doesn't know how to translate that into Lua, which I bet he is also relatively new too.
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Who is online
Users browsing this forum: Amazon [Bot] and 10 guests