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 2:40 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Problem with Indexation
PostPosted: Sun Sep 27, 2009 4:44 pm 
Offline

Joined: Sat Feb 14, 2009 1:10 pm
Posts: 7
Greatings FBA TC users and developer :D
I have registred here much erlyer, but didn't have reason(like this one) to "say hello" until now.
For start I would like to say Thank YOU! for Fba, looks like you've spend a hell of a time to make such a great developing tool.
And now to the Bug.
I've made a script but ther was some problem, I find out that it's about Indexation.
It is extracted from program and placed to this demo sample. You can just put it to
Quote:
main.fba
, RUN and press right side of project window.

Code:
function onmainloop()
clear(0,0,127)
fillrect(0,0,screenwidth()/2,screenheight(),127,0,0)
print(50,120,"quit",0,127,127)
print(screenwidth()/2+50,120,"start",127,127,0)
if mousedown()==1 then
   if mousein(0,0,screenwidth()/2,screenheight()) then
      quit()
   else
      FillMatrix()
   end
end
end

function FillMatrix()
pathx={}
for lx=0,100 do
    pathx[lx]={}
    for ly=0,100 do
        pathx[lx][ly]={}
    end
end
Progression(20,80)
end

function Progression(x,y)
    CheckQuadrant(x-1, y ,x,y)
    CheckQuadrant(x+1,y-1,x,y)
end

function CheckQuadrant(xin,yin,xor,yor) --<--<-- something rong at this function
           pathx[xin][yin] = pathx[xor][yor] -- here
            FullIndex("before "..xin..":"..yin.." : in ",pathx[xin][yin])
            FullIndex("before "..xor..":"..yor.." : or ",pathx[xor][yor])
           pathx[xin][yin][# pathx[xin][yin] + 1]=xor -- or here, or both
            FullIndex("after "..xin..":"..yin.." : in ",pathx[xin][yin])
            FullIndex("after "..xor..":"..yor.." : or ",pathx[xor][yor])
end

function FullIndex(text,lib)
debug(text)for num=1,# lib do debug(lib[num])end
end

in debug window got this
Code:
>> Output Debug Console
DEBUG: before 19:80 : in
DEBUG: before 20:80 : or
DEBUG: after 19:80 : in
DEBUG: 20
DEBUG: after 20:80 : or
DEBUG: 20
DEBUG: before 21:79 : in
DEBUG: 20
DEBUG: before 20:80 : or
DEBUG: 20
DEBUG: after 21:79 : in
DEBUG: 20
DEBUG: 20
DEBUG: after 20:80 : or
DEBUG: 20
DEBUG: 20

As we see
Code:
DEBUG: after 20:80 : or 
DEBUG: 20

and in the end
Code:
DEBUG: after 20:80 : or 
DEBUG: 20
DEBUG: 20

despite that original quadrant untouched
pathx[xor][yor]=={20,20}
but it should remain empty
HOW can it be? :shock:

Allso I found that wrighting 0 character to file imposible ( writefile(handle,string.char(0)) ), does it suppose to be like that or it's just a bug?

Thank you for any response.

P.S. Tomorow I'll try to post a small new function for Fba. :idea:


Top
   
PostPosted: Mon Sep 28, 2009 7:29 am 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
Root wrote:
Allso I found that wrighting 0 character to file imposible ( writefile(handle,string.char(0)) ), does it suppose to be like that or it's just a bug?


Mmmh..no it looks like a bug..maybe I consider files only in ascii mode.
Actually the only way to workaround this could be build an external dll.


Top
   
PostPosted: Tue Sep 29, 2009 7:38 pm 
Offline

Joined: Sat Feb 14, 2009 1:10 pm
Posts: 7
I guess you didn't understand what is the problem with indexation.
simple description:
script Value of x
x={} _____ {nil}
x[1]={1} __ {{1}}
x[2]=x[1] _ {{1},{1}}
x[2][1]=2 _ should be {{1},{2}} but it is {{2},{2}}
x[1] somehow binding to x[2] in 3rd row


Top
   
PostPosted: Wed Sep 30, 2009 2:55 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
Root wrote:
I guess you didn't understand what is the problem with indexation.
simple description:
script Value of x
x={} _____ {nil}
x[1]={1} __ {{1}}
x[2]=x[1] _ {{1},{1}}
x[2][1]=2 _ should be {{1},{2}} but it is {{2},{2}}
x[1] somehow binding to x[2] in 3rd row


Did you already read the LUA tables documentation?
http://www.lua.org/pil/2.5.html
Actually FBA is entirelly LUA based, so any script related questions should be covered in LUA docs.


Top
   
PostPosted: Sun Oct 11, 2009 1:19 am 
Offline

Joined: Tue May 12, 2009 1:31 pm
Posts: 7
When using the assignment operator with tables you don't pass a copy of the table, but its "address":
Code:
t1 = {1, 2, 3, 4}
t2 = t1

t2 isn't = {1, 2, 3, 4}, but it's a "pointer" to t1...


Top
   
PostPosted: Sun Oct 25, 2009 7:35 pm 
Offline

Joined: Sat Feb 14, 2009 1:10 pm
Posts: 7
Thank you. Sorry, little dumb question. I Just forgot about addresses and some other stuff.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 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