View Full Version : TBLua - Include and samples
Michael Hartlef
11-07-2007, 21:24
Hi folks,
because of Kent's interest in LUA and Eros providing a link to some PowerBasic headers of Marco Pontello, here is a conversion of his work for thinBasic. I don't think that we can make LUA aware of a thinbasic script function and then run it somehow, but at least it should be possible to run LUA scripts from within thinBasic and change thinBasic variables through a LUA script.
Please copy the TBLua.INC file into the thinbasic include folder.
Have fun
Michael
Michael Clease
11-07-2007, 22:15
Do the lib file need to be copied into the correct directory, I did anyway.
I dont see the benefits of using this (yet) the calling procedure seems so labour intensive.
ABX
Michael Hartlef
11-07-2007, 22:24
I don't need it too, but maybe someone has use for it.
Mike are you drinking the same super drink that Eros is? Wow that was incredibly fast how you did this. Thanks I will look at this and it will motivate me to learn LUA more.
I can't believe you are finished with this already. Thanks again!!
Michael Hartlef
12-07-2007, 06:35
Everyone could have done this as Powerbasic is allmost 100% thinBasic compatible. Or the other way around. ;D My job was more to get the three samples working, that's all. And that was a no brainer too.
ErosOlmi
12-07-2007, 06:38
... Powerbasic is allmost 100% thinBasic compatible. Or the other way around. ...
Let's say around 80% and only on language syntax.
Power Basic owner (Mr. Bob Zale) could send me his lawyers otherwise :D
I like the idea of tables and the way objects are handled in LUA. I hate having to define stuff in other oop languages and then turn around and write, well copy and paste the same things and then go and make changes before you can even use it. Just seems like a total waste. The idea of just making things as you need them then to get the benefits of OOP with little effort is so cool and logical. And I always had a weakness for dynamic types, I guess all personal preferences. I figure why should we as programmers have to do things the computer language should be able to do to free us to think creatively and put the code down before the idea lapses from thought.
ErosOlmi
12-07-2007, 08:08
I figure why should we as programmers have to do things the computer language should be able to do to free us to think creatively and put the code down before the idea lapses from thought.
Hey Ken, I fall down in similar situation quite often.
To empty the little buffer of my brain I started to use paper and pen to write down thoughts before they disappear ;)
Maybe I've some spare buffers in my brain but so far I was not able to find where they are :D
In any case programming (whatever language or technology you choose) is a precise set of elements (to be known), programmer behave and methodology. Some languages seems making the OOP simpler but the real judge is a big project. On big projects, if you do not make things like they need to be done from the very early stages of the project, you will find yourself quite soon lost in a cahotic situation.
Personally, I prefer languages that oblidge you: to be precise, to declare all elements, to define all variables. That's one of the reasons why I set variable declaration mandatory in thinBasic and why I developed the many data types present in thinBasic. For me it would have been much much better to have all VARIANT data type so no need to worry the many options all those data type need to take into consideration.
In any case, every people is different and that is what I like more. So ... hip hip urra both for fantasy and methodical programming :D
Ciao
Eros
Also Eros, in many languages that allow dynamic typing of sorts that many users still like to declare their variables and force those definitions with a command to make it so. I know it is the correct way to program and a better way, so no arguments there, in fact agreement. And also I like having the Global, DIM and Local options, at least if you do declare it helps with even more clarity with the scoping.
But being the lazy guy I am, just using variables at will is fun.
I think I read this in the LUA learning how to book online, but it could have been another source as I tend to read from multiple areas in one night to keep it interesting.
They mentioned that all math variables are stored as doubles and that with modern processors you get as good or even faster performance than using integers, even for storing integer values. I thought that was interesting.
ErosOlmi
12-07-2007, 22:00
They mentioned that all math variables are stored as doubles and that with modern processors you get as good or even faster performance than using integers, even for storing integer values. I thought that was interesting.
Agree. In fact I always use EXT data type internally and they are very fast. Of course LONG are the faster but they are integer data class.
I guess I sort of got confused again, I see now that thinBasic is like LUA in itself. That we should think about thinBasic like LUA and Python and not like C/C++ and Delphi. At least I think I get it better now. Besides the fact that thinBasic, LUA and Python are interpreted, and that c/c++/Delphi are compiled-- those scripting languages can make stand alone code or be used to put together modules written and compiled in other languages as DLL's and then be the unifying language to run those modules. Is this correct? Or am I still not getting it?