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 - Levak

Pages: 1 ... 7 8 [9] 10 11 ... 68
121
Miscellaneous / Re: Random YouTube Videos
« on: July 21, 2013, 07:16:05 pm »
Okay, I have to admit this one is a good one.

122
TI-Nspire / Re: Jens' Script Editor - An on-calc lua editor
« on: July 21, 2013, 07:08:52 pm »
@jwalker: Wow, didn't know that! I'll do some research about that. Is that function available in apilevel 1 and 2? That would be a nice option to kinda use the file system! :D
Here is an example : http://ourl.ca/10565/242834

123
TI-Nspire / Re: Battlestar for Nspire
« on: July 21, 2013, 10:02:01 am »
Double posts make the mods cry. Please use the edit button :)
It is not a matter of making mods cry, it's more a matter of discussion sanity because each post adds information about the author, which are the same when double/triple posting, and that is anoying.

On the other hand, double posting is tolerated in order to update the entire topic ("up") and make it visible in the first topics/IRC.
This is tolerated when it is usefull to update ("up") the topic, that means it has been couple hours since the last post.

Otherwise, editing the post is a good practice.

In that case I don't think it was a problem to double post, since it is a release announcement.

124
Lua / Re: Lua Q&A
« on: July 21, 2013, 08:11:15 am »
Q1: This is more of a confirmation. Does self refers to the classname itself? So self.x would refer to Coyote.x in this case? Likewise for the others?
The real meaning of "self" is the first argument passed to the function. When using ":" instead of "." (i.e : foo:bar() ) the object (here "foo") is passed as frst parameter :
Code: [Select]
foo:bar() === foo.bar(foo)
Thus, it refers to the instance of the object using that function, but it can be used for other purposes, such as using a "static" method of the class (I may be unclear on that ... sorry) :
Code: [Select]
Foo = class()
function Foo:init()
  self.i = 69
end
function Foo:bar(i)
  print(i, self.i)
  self.i = i
end
foo = Foo()
foo:bar(42) -- calls Foo.bar(foo, 42) ; prints 42 69
foo:bar(42) -- prints 42 42
print(Foo.i)  -- nil
Foo:bar(42) -- calls Foo.bar(Foo, 42) ; prints 42 nil
print(Foo.i) -- prints 42

Q2: What does . refer to? From what I gather it would mean it would add it to a list/table so that if Coyote was called up, you'd get Coyote == {"x"==x, "y"==y, "tiles"=={} etc...}. Is this right?
Basic : classes in Lua are reprensented as tables.
"." let you access to one element (defined of not) of a table. In Lua tables are associatives using all sort of hash key (you can use functions or tables as hash key). In general you access an element using its key with [ and ] such as :
Code: [Select]
t = {foo=bar1, ["foo with spaces"]=bar2}
t["foo"] -- bar1
t["foo with spaces"] -- bar2
t.foo -- bar1
As you can see, since "foo" is a valid identifier, it can be used with the "." convention.

There are multiple ways to add an element in the table, and it depends if you're seeing the table as a contiguous array (such as in C) or associatives ones.
It depends when you're using #t or ipairs/pairs(t). For example IIRC you cannot use #t or table.getn(t) on tables you filled with . or [] although you can iterate through using ipairs/pairs.

So, as you may understood, this :
Code: [Select]
t = {}
t.x = 1
t.y = 2

t.x = t.x + 2

for k, v in pairs(t) do
  print(k, v) -- will print x 3 \n y 2
end
adds to t two elements, modify one and prints keys and values of each rows.

Q3: How does or affect the variable assigning? in self.controls = options.controls or {up = "up", down = "down", left = "left", right = "right"}, does that mean self.controls becomes both possible values? This is one I'm stumped on
"or" and "and" are used as shortcut to if statements.
The equivalent or the line you quoted is :
Code: [Select]
if not options.controls then
  self.controls = {up = "up",
                        down = "down",
                        left = "left",
                        right = "right"}
else
  self.controls = options.controls
end

Another example :

Code: [Select]
a = 1
b = nil
c = 3

d = c and a or b -- d = 1
d = a and b or c -- d = 3
d = b and a or c -- d = 3


Q4: Also another one, I've never been very confident in what return means (even though I've encountered it in several languages such as JavaScript. I've known it to return a value if it refers to a variable but it seems that elsewhere in the code it can represent some other things too? Clarification?
The main difference between return in Lua and return in Javascript is that in Lua's return, you can return multiple values (known as "tuple")
Code: [Select]
x, y = 42, 69
function getCoords()
  return x, y
end

function setCoords(xx, yy)
  x, y = xx + 1, yy + 1
end

x, y = getCoords()
print(getCoords())  -- prints 42 and 69
setCoords(getCoords())
print(getCoords())  -- prints 43 and 70



Q5: Generally I don't understand classes enough, I don't think I finished reading through the inspired lua tutorial though. Might go back and read it ;D
Classes in Lua are based on metatables that can be a nightmare if you don't understand their concept. Maybe you can read for that.
If you still don't understand metatable (I was not able to understand them at the beginning, but understood classes) think of classes in other languages.
The main difference is that you don't have virtual method walkthrough since when you inherit from another class all the references are copied and the one you override overrides the references in the metatable losing the reference to the parent class. The only way to use a parent class is either by modifying the class() function, or by knowning the name of the parent class and using Parent.method(child, args) bootstraping the ":" notation.

125
TI-Nspire / Re: Jens' Skript Editor - a on-calc lua editor
« on: July 14, 2013, 07:10:42 pm »
Even if it is a pure off-topic, ...
only 1 post was downrated, so it might have been a misclick.
... so you're still thinking that downgrading posts, where there are positive arguments about that emulator, is a mistake/misclick ? even after what Lionel said ?
I also don't really like the way that uprating downratings hides what the first who downrated wanted to say by this vote.

126
TI-Nspire / Re: Jens' Skript Editor - a on-calc lua editor
« on: July 13, 2013, 12:12:21 pm »
Yes, I only used the gtk to extract boot2.img to boot2.raw but apparently that doesn't work anymore with 3.x
The recommended tool of TI-Planet "imgmanip" I can't use because I don't know how to C++  :-\
You can also use polydumper in order to dump the boot2.raw from the calc.

127
TI-Nspire / Re: Jens' Skript Editor - a on-calc lua editor
« on: July 13, 2013, 06:50:40 am »
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/
https://tiplanet.org/forum/viewtopic.php?f=57&t=8698

128
TI-Nspire / Re: Ndless Commander 0.4 -- TI-Nspire File Browser
« on: July 10, 2013, 04:46:11 pm »
There's a libndls function to refresh the document screen called refresh_osscr() ;)
Also notice that this function is time critical if the user has a lot of documents.
In other words, it is as slow as doing Home+2

129
TI-Nspire / Re: TI-nspire Hold 'em - Basic and Lua
« on: July 09, 2013, 07:39:10 pm »
but why do you usually vanish for several months even during school vacations?
I'm not the center of the world, but I still have school projects running on until end of july :p
And I also know that depending on your geographic position, vacations are shifted up to 6 months.

130
Lua / Re: Updating WZGUILib
« on: July 08, 2013, 06:09:49 am »
in case you replace the file and the download link gives a 404 on TI-Planet.
I don't understand your remark ?
You can update the archive details such as reupload the file on TI-Planet ... where is the problem ?

131
You said that I was comparing a scripted language with a compiled one, so since I was only talking about Lua and Grammer, it seemed to me that you thought that Grammer is compiled.
I took your sentence in the way you said it : "Lua" then "C" then "Grammer" then "Lua"
Now, let's paste my answer : "scripted" with a "compiled" then "interpreted" with a "scripted" one.
Comparing Lua to C is not the same as comparing Grammer to ASM. That was my POV.
But of course, the TI-Nspire Lua API can be optimized, I was just worried you were complaining about Lua using a false comparaison.

132
In case you didn't know, Grammer is not a compiled language
Where have I said that ?
Quote
Granted, Grammer uses tokens rather than individual characters for its commands
It's exactly what I said.

133
When they do something for developers it's usually not see how slow Lua is compared to ASM/C. If TI really cared about us, Lua would at least be proportional to Grammer speed compared to 84+ ASM.
You are comparing a scripting langage with a compiled one.
You are also comparing an interpreted (tokens) langage with a scripted one.
A scripted langage has to parse caracters, not tokens, its obviously slower !


The point you may be able to discuss, on the other hand, is the GUI API of the TI-Nspire Lua API.
There is a big mistake (but not so much possibilities) that the screen is prebuffered and disallows direct modifications. But, there are also plenty of functionnalities (like stroke width) that slow down a normal "stroke" to be drawn.
Another mistake are TI-Images, but we all know that. The fact is, that format is close to the one used by resources (like icons).

134
TI-Nspire / Re: Matrefeytontias's various animations
« on: June 24, 2013, 03:55:10 pm »
Else it's like if in a math class you asked help to the teacher and he started yelling at you (he would lose his job fast) about how retarded you are for not being able to solve the problem yourself. Plus it might make some people label you as a troll.
I am a bit concerned about what you said here... because it is exactly how I was thaught either maths or programming.
Okay, it was not "yelling", but kinda the same using french tournures. So maybe it's only a French aspect, or maybe it's only a matter of environnement where I live... but the fact is that it's a really motivating way to learn by yourself : Hard but Sucessful (see Adriweb comment).

Quote
As for what I sae in the comment I quoted, it seemed like you were trying to make Matrefeytontias feel or look stupid in front of other people. The way it was worded (or Google-translated?) and punctuated implied it at least. To avoid it in the future, you should probably say "Like nSDL?" Instead of "Like.. nSDL?", but also only ask it once instead of twice (just reply to both quotes at once).
As I said, it's maybe a language barrier, but I can't see any harmful part. The "..." are indeed here to mark a pause like "Are you kidding me ?", but not a "you are stupid ...".

May we close this debate then ?

135
TI-Nspire / Re: Matrefeytontias's various animations
« on: June 24, 2013, 06:31:54 am »
Levak & Lionel although I understand (and agree with) your points, it would be best to leave him do what he wants if he is not willing to use an external lib. Insisting will not work. :P
Am I forcing him the way of using nSDL ?
I've just read the entire topic in order to see if I made a sentence in this way and I couldn't find any.
What I was trying to determine are
1) is he using a library (his liibrary !) the proper way, not like a toolkit (and, as far as I understood, he is not using it the proper way) and
2) why doesn't he use nSDL in that case ? (in the case he is indeed using a toolkit).

Quote
Also to Levak, this is Omnimaga. There is a difference between criticizing Matrefeytontias and being a total jerk to him. The former is perfectly fine and allowed on Omni, but the latter is not.
What ? Where have I been a total jerk to him ? Either you missread my posts, or I don't understand your's

Quote
The second half of your first post, along with most of your 2nd and 3rd post (and the entire content of Lionel's posts) are fine, but the tone that you used in the following quote was totally uncalled for:
for this I reused part of a library I'm writing to deal with screen and pixels
Like ... nSDL ?
Quote
My library handles cross-compatibility, so you can use the same *.tns file for both CX and non-CX calcs :)
Like ... nSDL ?

From Omnimaga front page:
Quote
Our community goal is to provide a discussion environment free of any hostility for all coders wanting to learn, give or get help, showcase their work, discuss
Is that rude or hostile ? If so, I guess it's a language barrieer, and even if french around here feel it rude, then here is my signature from TI-Planet :
Quote
I do not get mad at people, I just want them to learn the way I learnt.


Quote
We are trying to get people to learn
Me too.

Quote
not trying in every way possible to scare them away from the forums
May I shave myself then ?

Quote
discourage them from coding.
Bad coding style is not something learnt a lot on the web, and that really sucks.
We all started with a bad looking code, aren't we ?
Where did we learn how to fix this ? With dicussions like that.

Coding would be like drawing. Some will use a computer with pre-drawn stuff and magikal effects, but at least will only press "buttons".
In the artistic domain it is asked for them to draw by and understand the basics, learn good gestures. Why isn't that learnt through a community ?

From what I understand with this discussion is that, some people here are not willing to use comments in order to progress, are against the change.

Pages: 1 ... 7 8 [9] 10 11 ... 68