FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Thu Jun 04, 2026 3:48 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jun 25, 2008 12:17 pm 
Offline
FBA Startup-Logo Creator
FBA Startup-Logo Creator
User avatar

Joined: Wed Jun 18, 2008 11:40 am
Posts: 100
Location: Brighton, UK
I want to read in a 3 digit number from a text file so using getres(0,3)
But how do I turn this into a numeric/integar?

_________________
http://www.boiledsweets.com


Top
   
PostPosted: Wed Jun 25, 2008 12:59 pm 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
I've found that the interpreter converts them automatically without problem. I don't have any code to force it in my calculator. But if it isn't working or you want to be sure, try using tonumber("string"), which is a Lua function that seems to work just fine in FBA based on my small test.

_________________
Don't look at me. I'm new here.


Top
   
PostPosted: Wed Jun 25, 2008 1:01 pm 
Offline
Feejo Member
Feejo Member
User avatar

Joined: Fri Mar 28, 2008 8:07 am
Posts: 64
Location: Italy
Not sure to understand your question but the following works:

Code:
openres("resource.txt")
num = getres(0, 3)
num=num+1
closeres()

function onmainloop()
        print(100,100,num,255,255,255)
end

_________________
Regards,

umbiomar
[email protected]


Top
   
PostPosted: Wed Jun 25, 2008 1:07 pm 
Offline
FBA Startup-Logo Creator
FBA Startup-Logo Creator
User avatar

Joined: Wed Jun 18, 2008 11:40 am
Posts: 100
Location: Brighton, UK
tonumber did it! Thanks...

I guess I ought to take a look at the LUA docs :-)

_________________
http://www.boiledsweets.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited