Jump to content
The simFlight Network Forums

Question on LUA ...


Recommended Posts

*** Moved from FAQ sub-forum to main support forum ***

Apparently chars vs numbers cause issue  when dealingg with strings...

I wanted to grab text from the end of  ipc.readSTR(0x0130, 256) which is the loaded flight plan .pln file

 

 

zzz = ipc.readSTR(0x0130, 256)
xyz = string.sub (zzz, -22)
abc=ipc.ask("here" .. xyz, WHITE)

returns nothing...

but if I hardcode zzz with "data within double quotes"
last 22 chars are returned

how do i make this work in a simple solution ?

Edited by John Dowson
Moved to main support forum
Link to comment
Share on other sites

First, you posted in the FAQ sub-forum where it explicitly states NOT for support requests. Please take care to post in the correct forum for support, which is here or in the FSUIPC7 / MSFS sub-forum.

I am not sure what your issue is, but sounds like the offset being read is empty. Why don't you try logging the value after it has been read, e.g.

zzz = ipc.readSTR(0x0130, 256)
ipc.log("String read from 0x0130: " .. zzz)

xyz = string.sub (zzz, -22)
ipc.log("Last 22 chars: " .. xyz)

18 minutes ago, Fltbuff7197 said:

Apparently chars vs numbers cause issue  when dealingg with strings...

I don't know what you mean by this - you are not using any lua numbers...but if you want to use a string as an integer, you can use the lua tonumber(string) function.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.