LUA

LUA

Anonymous
Not applicable
1,584 Views
16 Replies
Message 1 of 17

LUA

Anonymous
Not applicable

I am new to LUA.  I am trying to find the best way to learn it.  I am trying to use Sublime 3 to write progams in LUA but i have no idea how to set it up to where I can type a program and see it run for within Sublime text 3.  I download LUA for windows but  I would rather use LUA in Sublime text 3 because a can see it better. Thanks have a good day

Reply
Reply
Accepted solutions (1)
1,585 Views
16 Replies
Replies (16)
Message 2 of 17

frank.delise
Alumni
Alumni
You should try the script editor that comes with Stingray, it has autocomplete , breakpoints and some debugging tools.

Also lua.org has info on Lua as well.
Reply
Reply
Message 3 of 17

Anonymous
Not applicable

That is what I was leaning to.  So I can write a small program and run it and see resulst without breaking anything.

Reply
Reply
0 Likes
Message 4 of 17

am964
Alumni
Alumni
Accepted solution

Another benefit of using the script editor that comes with Stingray is autocomplete feature. For example, if you type 

 

stingray.Unit. 

 

the autocomplete will show you a list of all methods that Unit supports, along with the parameters that each function takes. This will make it a lot easier for you to program in Lua. The autocomplete information comes straight from our docs. You can also open up the ref doc by right clicking on a function name in the script editor.

 

The script editor also features syntax highlighting, so if you have an error in the syntax, you'll see an x mark on the line containing the error. You'll also not be able to run your project if there is a Lua error.

 

The script editor will get better over time, with full support for debugging.

Reply
Reply
Message 5 of 17

Anonymous
Not applicable
Auto-complete is one of the reasons I use Visual Studio instead of MONO Develop, so THANKS!
This is a first time hearing of LUA for me, goodness why you guys couldn't just pic something with huge community support like C Sharp or C ++
Reply
Reply
0 Likes
Message 6 of 17

Anonymous
Not applicable
Lua is already very popular in the commercial game space, and has been for years. Many engines and games use it. More industry games professionals are likely to be familiar with Lua than with C#. As for why not use C++, well, Stingray is made with both C++ and Lua, so there you go 🙂
Reply
Reply
Message 7 of 17

am964
Alumni
Alumni

Lua is heavily used in game programming, has a small and lightweight VM, JITs for Lua are available on all platforms that support JIT so you almost get the performance on native code. C# has a much heavier backend and is hard to support for all platforms. 

Reply
Reply
Message 8 of 17

Anonymous
Not applicable
Quick question: would you guys be willing to expose a way to communicate with the checker/autocomplete system in the Stingray editor? (Is there already a way to hook into it?) A plugin could then be written for Sublime Text (or another popular editor).

The built-in editor seems nice but it's lacking configurability at the moment. Also, as for myself, I'm a vi/vim holdout, so I won't ever use a text editor without a vim emulation mode, and I don't expect you guys to add that anytime soon 🙂
Reply
Reply
Message 9 of 17

Anonymous
Not applicable
DANG!!! So clearly I just identified myself as the NOOB I am! I wish I hadn't spent so much time studying C Sharp.
Well anyways you guys nailed that question kudos for you both!
Reply
Reply
0 Likes
Message 10 of 17

am964
Alumni
Alumni

Yes definitely. We'll love to expose hooks in to the autocomplete system if technically possible/feasible.  I'll loop in the engineer who worked on the autocomplete feature, he should be able to provide more info about this. 

Reply
Reply
Message 11 of 17

Anonymous
Not applicable

Okay forgive me but when it comes to Lua I am a newbie.  I know C++, C#, objective C and even some Unrealscript.  I want to learn Lua by writtings some simple programs.  So if I wanted to do Hello world what would be the sets using Stingray how do I run the program. Is there a way to get to the Lua editor in Stingray without going all they way into stingray.  i don't mind using the one in Stingray but Visual Studio has spoiled me as far as being easy to use.

Reply
Reply
0 Likes
Message 12 of 17

Anonymous
Not applicable

Lua usually runs embedded as a part of another application, not standalone. So you'll need to run the Stingray Editor if you want an easy time editing and running your code. Probably easiest way to get started would be to create a new 'minimal' project in Stingray and work from there. Try putting  print "hello world" inside of the initially empty Project.update(t) function within the project.lua file. If you hit the play button it should print "hello world" to the log console on every frame.

Reply
Reply
0 Likes
Message 13 of 17

Anonymous
Not applicable

I have been using UE4  and wanted to try something different.  UE4 is great but I can see where Autodesk can be a very good engine.  So far I don't find it easier than UE4 but I have been at it for only a few days.  Some of this is very frustrating but I am off for the next 2 weeks and I am going to see how far I get with Stingray.  I don't know if they have any Lua tutorials if they do it would be nice to see some.  So far I am frustated but like I said I am going to give it two weeks of constant learning and see where I get.  Now  I don't expect to be able to make the next GTA 5 in the next two week, but I should see some progress.  I would also love to see something about how to rig my characters  to work in Stingray.  I had one going from Maximo Fuse and things were going pretty good unit I had to find a reference bone to stop my character from moving while in the run state of a animation.  I take it that I need a root bone to able to work in Stingray.  Should I use the Human IK rig in Maya Lt(Which has changed some) should I make my own rig as long has it has a root or reference bone.  Well sorry for the long message I just have a lot of questions. Oh!  Is navigation >+ Synaspe  tons of question.  Have a good day guy and keep at it.

Reply
Reply
0 Likes
Message 14 of 17

Anonymous
Not applicable

Oh! thanks!!

Reply
Reply
0 Likes
Message 15 of 17

_robbs_
Alumni
Alumni

I don't want to derail the thread, but to answer your question the autocomplete is based on data that the script editor reads from JSON files. Have a look in your install directory for the

 

editor\Resources\lua_api_stingray3d.json

editor\ScaleformStudio\resources\lua_api_s2d.json

 

files. If you want to support autocompletion for our API elements inside a different text editor like Sublime, you should be able to scrape the data you need out of these files.

 

We decided not to provide any out of the box because time is short and we wanted to concentrate on making the built-in editor as complete as we could, and to let the community tell us else what was needed. What kind of configurability exactly are you missing (besides vi emulation)? Do you mean colors and fonts and such, or something more?

Reply
Reply
0 Likes
Message 16 of 17

Anonymous
Not applicable

That did not work for me I must be doing something wrong. Thanks anyway. 

Reply
Reply
0 Likes
Message 17 of 17

colin.branch
Alumni
Alumni

If the failure you were referring to was the print' statement, the example was missing its requires parathesis: print("Test")

 

As for the json autocomplete data, the files are available for anyone to use them. It is a fairly simple plaintext data file which can be used to generate bindings for any editor which has the necessary language support. It format itself will likely evolve in the future as additional features are added. The plan is to store all information regarding the API for the editor in an external data file.

 

While Stingray's script editor is currently limited in configurability, it is already rather powerful as a debugging tool when used with Test level. In future releases it will improve in all of these areas. Ultimately given the diversity of development environment preferences, we want to ensure that we provide both a tool which is both easy to learn and powerful while not locking users out of there preferrerd tools.

Reply
Reply
0 Likes