Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jim Bauwens

Pages: 1 ... 26 27 [28] 29 30 ... 125
406
TI-Nspire / Re: Matrix Library
« on: June 23, 2012, 04:24:08 pm »
It should not allow it. You can modify __newindex so to parse the input and possible modify it.
The above code is just the concept, you can build on it and make it do what you want.

Edit: wait, it does. Let me fix it

407
TI-Nspire / Re: Matrix Library
« on: June 23, 2012, 04:06:12 pm »
Well, here is almost the same for a matrix:

Code: [Select]
function createProxy(tbl)


local mt = {}
local proxy = {}
mt.__index = function (t, key)
local rownumber = rawget(t, "rownumber")
if rownumber then
return tbl[ rownumber][ key]
else
return tbl[ key]
end
end

mt.__newindex = function ()
print("You are not allowed to write to this table!")
end

for key, row in ipairs(tbl) do
proxy[ key] = {}
proxy[ key].rownumber = key
setmetatable(proxy[ key], mt)
end

setmetatable(proxy, mt)

return proxy
end


a = createProxy{{5,4,3,2,1},{3,6,9,1}}

print(a[ 2][ 3])
a[ 2][ 3] = 3
print(a[ 2][ 3])

408
TI-Nspire / Re: Matrix Library
« on: June 23, 2012, 12:48:21 pm »
If you don't want users to have direct write access to the table, you can use something like this:

Code: [Select]

function createProxy(tbl)
local mt = {}
local proxy = {}
mt.__index = function (_, key)
return tbl[ key]
end

mt.__newindex = function ()
print("You are not allowed to write to this table!")
end
setmetatable(proxy, mt)
return proxy
end


a = createProxy{1,2,3,4,5}

print(a[2])
a[2] = 3

I'm taking a look at your code.

Edit: ouch, the forum is changing table keys to nobbc
Edit2: Okay, I think class you be something for you. You should be able to protect your variables enough.

409
TI-Nspire / Re: Matrix Library
« on: June 23, 2012, 12:17:42 pm »
Here is the class function (although slightly modified):
Code: [Select]
class = function(prototype)
local derived={}

  if prototype then
derived.__proto = prototype
  function derived.__index(t,key)
  return rawget(derived,key) or prototype[nobbc]
  end
  else
  function derived.__index(t,key)
  return rawget(derived,key)
  end
  end
 
  function derived.__call(proto,...)
  local instance={}
  setmetatable(instance,proto)
  instance.__obj = true
  local init=instance.init
  if init then
  init(instance,...)
  end
  return instance
  end
 
  setmetatable(derived,derived)
  return derived
end

I think you want something like this:

Code: [Select]
Matrix = class()

function Matrix:init(mat)
    self.matrix = mat
end

function Matrix:set(x, y, n)
    self.matrix[y][x] = n
end


matrix1 = Matrix{{1,2,3},{1,2,3},{1,2,3}}
matrix2 = Matrix{{1,2,3},{1,2,3}}

matrix1:set(1,1,3)

matrix1 and matrix2 are not connected in anyway. You can expand the matrix class to your wishes.
Also, with metatables/-methods you could even make that matrix3=matrix1+matrix2 is possible :)

410
News / Re: Release of FormulaPro for the Nspire
« on: June 22, 2012, 09:16:22 am »
And there is another update available :)
It contains a fix for an endless loop in solving.
Remember, you can always download the latest build at https://github.com/adriweb/EEPro-for-Nspire/blob/master/EEPro.tns?raw=true .

Thanks :)

411
Other Calculators / Re: Your calculator collection
« on: June 22, 2012, 12:25:57 am »
That's stll a good amount :)

Regarding the fake solar panel, I have had two calculators with fake ones too....

412
News / Re: Release of FormulaPro for the Nspire
« on: June 22, 2012, 12:12:19 am »
The CAS will never be as good, and it will only be used for solving of formulas. No problem there :)

(PTT removes access to all document, even Lua so there will not be a problem anyway)

413
News / Re: Release of FormulaPro for the Nspire
« on: June 21, 2012, 06:25:08 pm »
It will run, but you will not get results. It is because the math is so complex :(

414
News / Re: Release of FormulaPro for the Nspire
« on: June 21, 2012, 06:11:54 pm »
Sorry, I don't think there will be a prism version ever.
Also, something we forgot to mention is that it requires a CAS calculator. We are busy making a CAS in lua, but it will still take some time before we can use that.

415
Lua / Re: Just vote quickly please :P UI poll about FormulaPro
« on: June 21, 2012, 03:45:33 pm »
Thank you all for your votes, I set it to the bottom as default.

Darl, that would be a bit weird :P

416
News / Re: TI-Nspire OS 3.2 is out!
« on: June 21, 2012, 06:57:44 am »
TI will fix the issue, and they will update it as soon as they can. I'm sure they will not waits months to release it.

417
News / Re: TI-Nspire OS 3.2 is out!
« on: June 20, 2012, 02:34:13 pm »
3.2.1219 isn't much different. The slowness isn't fixed yet, but the cause has been found.

418
ASM / Re: My first 68k asm program: a small sprite routine
« on: June 20, 2012, 04:15:31 am »
Aw, I'm sorry that nobody is responding. I would if I knew a bit more.
Anyway I see you got your saferam solution on yAronet ^^

And that screenshot looks nice :)

Edit: hey some else responded too :D

419
Miscellaneous / Re: strange laptop screen
« on: June 18, 2012, 05:19:26 pm »
I have had a similar issue on my netbook. It might be related to your bios, so check for an update. Also be sure you got the correct graphics driver.

420
Lua / Re: Updating WZGUILib
« on: June 18, 2012, 02:18:47 am »
Is the problem related to the "middle" in [lua]gc:drawString[/lua] you used, or did you not use anything before ?

(I recommend you to use "top". I have no problems in 3.1/3.2 with it, as it's the most accurate argument)

Pages: 1 ... 26 27 [28] 29 30 ... 125