IrrLua

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Guest

Post by Guest »

how about you read the thread :) ?
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

needforhint wrote:what is irrlua? :lol:
IrrLua is a lua language binding for irrlicht. It allows you to use Irrlicht within the Lua language, like how Jirr lets you use Irrlicht in the Java language. Click here for some screenshots. The pics are poor, but you can kind of see the lua console in the background running the example scripts.

Lua is becoming a popular scripting language for games due to it's size and features. Some notable games that use lua are Balder's Gate, MDK2, World of Warcraft and FarCry.
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

IrrLua 0.6.0 has been released for Irrlicht-0.14.0.

release notes:

Fixed a bug with IVideoDriver.draw2DImage
various bug fixes
Proxy system (see below)
Removed the single device restriction. You can now have multiple irrlicht devices in IrrLua

------ From the documentation

Creating new Irrlicht objects in Lua

IrrLua now supports the creation of 'pure virtual' Irrlicht classes, which allows you to dynamically extend the Irrlicht engine at runtime using Lua.
The following functions are used to create new Irrlicht classes based on a Lua class:

function irr.createIEventReceiver(lua_class)
function irr.gui.createIGUIElement(type, environment, parent, id, rectangle, lua_class)
function irr.scene.createIAnimatedMesh(lua_class)
function irr.scene.createIAnimatedMeshSceneNode(parent, manager, id, lua_class)
function irr.scene.createIMesh(lua_class)
function irr.scene.createIParticleAffector(lua_class)
function irr.scene.createIParticleEmitter(lua_class)
function irr.scene.createISceneNode(parent, manager, id, lua_class)
function irr.scene.createISceneNodeAnimator(lua_class)
function irr.scene.createISceneNodeAnimatorCollisionResponse(lua_class)
function irr.scene.createITriangleSelector(lua_class)
function irr.video.createIShaderConstantSetCallBack(lua_class)


---
zenaku
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

:cry:
The dynamic runtime extensions in IrrLua 0.6 are broken for multiple objects. I've fixed the issue so expect a new 0.6a release soon.

---
zenaku
Coty
Posts: 8
Joined: Tue Nov 08, 2005 1:34 pm

Post by Coty »

IrrLua and IrrWizard are the two main reasons I come here. I'd like to see some game project made from them. I believe they are excellent projects. maybe combine them into an excellent game! :) I'm not a programmer, but I am able to compile them. I would love to help with any project made from them. I always look forward to the next release...


I am tempted to learn Lua now :)

Keep up the good work!

Coty
alelink
Posts: 52
Joined: Tue Jan 20, 2004 8:32 pm
Location: Italy
Contact:

Post by alelink »

Hello,
this question maybe really stupid, so forgive me:

can I build a program that set-up Irrlicht, do others, and read the lua
scripts when needed, without running tha LUA console?

This system is suitable for creation of adventure games I think.

thanks
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

irrlua-0.6.1 released

Post by zenaku »

Irrlua 0.6.1 has been released. This release fixes the issues with the dynamic runtime extensions. Sorry about that! :)
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

alelink wrote:Hello,
this question maybe really stupid, so forgive me:

can I build a program that set-up Irrlicht, do others, and read the lua
scripts when needed, without running tha LUA console?

This system is suitable for creation of adventure games I think.

thanks
Absolutely. :) You can create a program that runs a single Lua file if you wanted instead of reading from the console. Under windows, you have to make a 'non-console' program if you don't want to see a console window. main() vs WinMain() ...
Guest

Post by Guest »

zenaku -- Great work on irrLua. I am currently trying to build it into my project. For some reason, under MS VS 2005, I get 40 warnings about depreciated this and that. Do you know how I can get rid of the warnings? Thanks.
Guest

Post by Guest »

It's me again. Here are the warnings:

Warning 1 warning C4996: 'mbsrtowcs' was declared deprecated d:\irrlua\include\irrluacast.h 48
Warning 2 warning C4996: 'strncpy' was declared deprecated d:\irrlua\include\irrluacast.h 62
Warning 3 warning C4996: 'wcstombs' was declared deprecated d:\irrlua\include\irrluacast.h 80
Warning 4 warning C4996: 'wcstombs' was declared deprecated d:\irrlua\include\irrluacast.h 96
Warning 5 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaeventreceiver.h 46
Warning 6 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaeventreceiver.h 77
Warning 7 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaeventreceiver.h 110
Warning 8 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaeventreceiver.h 141
Warning 9 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaeventreceiver.h 173
Warning 10 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenode.h 224
Warning 11 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenode.h 318
Warning 12 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenode.h 678
Warning 13 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenode.h 832
Warning 14 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaishaderconstantsetcallback.h 77
Warning 15 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 243
Warning 16 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 281
Warning 17 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 427
Warning 18 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 458
Warning 19 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 491
Warning 20 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 522
Warning 21 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 554
Warning 22 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 577
Warning 23 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiguielement.h 680
Warning 24 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaimesh.h 167
Warning 25 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmesh.h 148
Warning 26 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 76
Warning 27 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 125
Warning 28 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 237
Warning 29 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 260
Warning 30 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 520
Warning 31 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 614
Warning 32 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 974
Warning 33 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaianimatedmeshscenenode.h 1131
Warning 34 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiparticleaffector.h 77
Warning 35 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiparticleemitter.h 85
Warning 36 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaitriangleselector.h 146
Warning 37 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenodeanimator.h 76
Warning 38 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenodeanimatorcollisionresponse.h 42
Warning 39 warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) d:\irrlua\include\irrluaiscenenodeanimatorcollisionresponse.h 260
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

Yeah, I get them too. You can ignore them.

The bool warnings shouldn't be warnings, IMO. They'll be 'fixed' in the next release.

Basically, to get rid of the bool warnings, MSVC forces a paradigm on you:

Code: Select all


// Generates warning message
bool ret = (bool) lua_toboolean(L, -1);

// no warning message
bool ret = lua_toboolean(L, -1) != 0; //boolean expression makes assignment boolean

It's kind of silly for MS to force the paradigm on you. Casting to boolean, although frowned upon, should work the same way. If they want you to explicitly spell out that int != 0 when comparing boolean they should just assume that when you cast to bool for the 'performance' warning, IMO. You are already making assumptions when you are casting.

If you think those warnings are bad you should compile IrrLua_imp.cpp with warnings on. ;) In the IrrLua project, that one file has warnings disabled completely because there are so many warnings in it (also it's a huge file). That file is generated by tolua++ so there isn't much I can do about that.

For the deprecation warnings, you can add _CRT_SECURE_NO_DEPRECATE to the preprocessor definitions. I'm not going to change code to fix those warnings, otherwise it becomes MS specific code.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
MarcoTMP
Posts: 37
Joined: Mon Aug 29, 2005 8:14 pm
Location: Dominican Republic
Contact:

Post by MarcoTMP »

Hi Zenaku, IrrLua is a great project! and as you know my project (IrrGameShell) is based on it :D

i'd like to save .lua files in .zip and then read it from IrrLua. Is there a way to do it already, or i have to create an irrlua_dofile(filename) using irrlicht I/O functions.?
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

MarcoTMP wrote:Hi Zenaku, IrrLua is a great project! and as you know my project (IrrGameShell) is based on it :D

i'd like to save .lua files in .zip and then read it from IrrLua. Is there a way to do it already, or i have to create an irrlua_dofile(filename) using irrlicht I/O functions.?
The simplest way would be to extract the file from the archive, and then simply use lua's built in 'dofile'.

If you want to run scripts directly out of the zip file without extracting, you'll indeed need your own 'irrlua_dofile' function.

Irrlicht uses the IReadFile and IWriteFile interfaces for dealing with files, so when you do FileSystem->addZipFileArchive(), you then get an IReadFile, so to make it work the irrlua_dofile() function will need to take an IReadFile as a parameter instead of a filename.

You could almost do everything completely in lua, except that IrrLua currently doesn't support IReadFile's 'read()' function (it uses void * which is a pain).

If it did, you could use IrrLua to read the file into a string, and then use lua's loadstring() function.

The correct way would probably be to do it in c++, however. Here's some more info: http://www.lua.org/pil/24.1.html

If you look at the code, you'd basically be doing the same thing except with IReadFile instead of fgets().

I never really thought about it but 'irrlua_dofile' for IReadFile objects would be a pretty useful ability ;). I'll try and add it into the next release.


Finally, there are a lot of other Lua modules besides IrrLua. You might get a lot more done if you incorporate them into IrrGameShell.

For example, there is already a LuaZip library that should integrate well with IrrLua.

You could then do something like:

Code: Select all


require "zip"

local zfile, err = zip.open('luazip.zip')

-- print the filenames of the files inside the zip
for file in zfile:files() do
	print(file.filename)
end

-- open myscript.lua and run it
local f1, err = zfile:open('myscript.lua')

dofile(f1)

Hope this helps.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
MarcoTMP
Posts: 37
Joined: Mon Aug 29, 2005 8:14 pm
Location: Dominican Republic
Contact:

irrlua_dofile for the next release :)

Post by MarcoTMP »

zenaku wrote:I never really thought about it but 'irrlua_dofile' for IReadFile objects would be a pretty useful ability ;). I'll try and add it into the next release.
Great!!!!! :D

I liked the idea of using LuaZip library, but the idea of include it inside IrrLua is much better. :wink:
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

IrrLua-0.7 released

Post by zenaku »

IrrLua-0.7 has been released. This has mostly been a stability and bug fix release with a few more functions bound to Lua. Also, the website and documentation have been updated/improved.

MarcoTMP, a new function 'irr.io.dofile(IReadFile)' is now implemented. You can now run scripts out of zip files.


Enjoy! :)
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
Post Reply