Jump to content

[ASK] Why use LUA codeing ?


witawat
 Share

Recommended Posts

Lua was introduced really as an object scripting language and support for it is embedded in the Leadwerk API code, so it works regardless of what language you are using to write your game.

 

Some people are taking it further and writing their entire game in Lua. I personally wouldn't do that, but if the game is simple enough and doesn't involve a lot of heavy computation then it's quite practical to do so.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

I use LUA to code some parts of stuff i would like to let Map makers or artists modify.

 

Atm most of my LUA code is for objects like Cars, or static objects that have some behaviour (like lights etc).

 

A thing that would be good to code in LUA would be also Interface, i'm trying to work on that, also to let non programmers be able to modify part of the stuff i code.

 

With things like SetGlobalObject or SetKey you can set global objects or object variables from LUA that you can use in code.

I use this to send settings of object files to my C++ code.

Link to comment
Share on other sites

I use LUA for everything because I get none of the hassles of C++. If I need to really optimize some code I will compile the LUA code into a .luac file. Compiled LUA is almost as fast as C++.

Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D

Link to comment
Share on other sites

In Leadwerks3D, Lua will also be an easier route because you don't have to mess around with different projects and compilers, especially for mobile platforms.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I use LUA for everything because I get none of the hassles of C++.

One could equally argue you get none of the advantages of C++ either, but I don't want to rain on your parade. We each choose a path and live with the consequences smile.png

  • Upvote 1

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

I launch LUA from c++ code using

 

 BP L=GetLuaState();
 lua_pushobject(L,fw);
 lua_setglobal(L,"fw");
 lua_pop(L,1);

 

Problem is, i have no clue on how to protect the scripts folder and make it work.

 

I can protect the data folder and it works ok with something like this:

 

SetZipStreamPassword("data.pak","pass");
RegisterAbstractPath("/data");

 

I been trying to do the same with scripts folder in the same data.pak, or in scripts.pak with RegisterAbstractPath("/scripts"), but it simply won't work.

 

Error i get is "can't open script/class". So far i wasn't unable to solve this.

Link to comment
Share on other sites

  • 1 month later...

What do you talking about? :) Hide..code..password. Ok, seems like Quake3 code are shared, which one of you all see it? I think is code doesn't need anyone. Need ready product. And if some peace of my code will have somebody - he's welcome (after project release). Because next code - is always better than previouse.

"Better" is big enemy of "good"

Link to comment
Share on other sites

Guest Red Ocktober
why use lua codeing

 

seamless integration with the editor... most people use lua to implement functional capable instances of their object in the editor... at least that's what i see as the primary benefit...

 

conceivably, if you script enough self contained objects you should be able to load and play your game entirely in the editor...

 

not sure how practical that'd be, but...

 

also (as mentioned above), there's the cross platform aspects to consider...

 

--Mike

Link to comment
Share on other sites

Mike is right on the money, Editor makes my life easy (atleast), so design levels and setup smart lua objects in the editor and load the scene using whatever language you want to run your game code in (c++ / pascal etc..) including all libs you need etc.. Or just use lua for everything.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...