Hey, thanks zenakuzenaku wrote:MarcoTMP, a new function 'irr.io.dofile(IReadFile)' is now implemented. You can now run scripts out of zip files.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Hey, thanks zenakuzenaku wrote:MarcoTMP, a new function 'irr.io.dofile(IReadFile)' is now implemented. You can now run scripts out of zip files.
Here's a quick hack you can do to the 'LuaInterpreter' project.elander wrote:I have upgraded my little game to this version and didn't have any problems so far.
Is there any other way to launch an irrlua application unless using an msdos box? I would sugest an executable like start.exe that could be renamed and would read a start.ini file (or another name.ini if the file was renamed) to know whats the root lua script to run.
Im not such a big windows programmer so i can't do this myself.
Code: Select all
#include <windows.h>
Code: Select all
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
lua_State *l = lua_open();
lua_userinit(l);
int ret = lua_dofile(l, "startup.lua");
lua_close(l);
return ret;
}
Code: Select all
dofile("01.HelloWorld.lua")
Code: Select all
local answer = io.read("*line")
local driverTypes = {["a"] = irr.video.EDT_DIRECT3D9,
["b"] = irr.video.EDT_DIRECT3D8,
["c"] = irr.video.EDT_OPENGL,
["d"] = irr.video.EDT_SOFTWARE,
["e"] = irr.video.EDT_SOFTWARE2,
["f"] = irr.video.EDT_NULL }
local type = driverTypes[answer]
if type == nil then
return 0
Anything is possible, but doing that is non-trivial.elander wrote:Would it be possible to change the lua executable to detect when it is being called from dos prompt and when it is being called from explorer and select the apropriate startup method automaticaly? Like i said i don't understand much of windows programming so this is just a wild guess, but it would be very useful if this was possible. I know that some apps can do this and even start as app from a dos window and let the user close the dos window afterwards.
I tried to download this stuff from the LuaZip site but unfortunalty the only thing they have is a .c file a zip.dll which i assumed it can only be used used to compile to whatever program is enbeding lua.zenaku wrote: 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)
All of that will be possible with Lua 5.1. The problem with lua 5.0 is there isn't a standard way of dealing with binary modules. You get loadlib() and that's about it. Lua 5.1 addresses that issue, so you can expect prebuilt binary modules for lua to start taking off with Lua 5.1. With Lua 5.0, you have to roll your own, which is what I did with IrrLua.elander wrote:I tried to download this stuff from the LuaZip site but unfortunalty the only thing they have is a .c file a zip.dll which i assumed it can only be used used to compile to whatever program is enbeding lua.zenaku wrote: 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)
It would be great if we could install a package by just copying the files zip.lua and zip.dll somewhere the simply use 'require "zip"' in our script.
This would gives an opurtunity to use lua jit:
http://luajit.luaforge.net/
My script startup would be:
luajit.exe main.lua
And in the main.lua source:
require "irrlua"
require "zip"
require "audiare"
require "newton"
require "dustyengine"
function main()
do stuff
end
Do you think this is possible?
Code: Select all
function irr.gui.createIGUIElement(type, environment, parent, id, rectangle, def)
local o = {}
for i,v in pairs(def) do o[i] = v end
-- the line blow is right?
o.__c_class = irr.scene.IrrLuaIGUIElement:new()
tolua.inherit(o, o.__c_class)
tolua.takeownership(o)
o.__index = function (t, k) return rawget(t,"__c_class")[k] end
setmetatable(o, o)
irr.__iguielementproxy[o.__c_class:GetProxy()] = o
return o
end
The code above is broken.mgphuang wrote:and this function can not be call ,a nil value.Code: Select all
function irr.gui.createIGUIElement(type, environment, parent, id, rectangle, def) local o = {} for i,v in pairs(def) do o[i] = v end -- the line blow is right? o.__c_class = irr.scene.IrrLuaIGUIElement:new() tolua.inherit(o, o.__c_class) tolua.takeownership(o) o.__index = function (t, k) return rawget(t,"__c_class")[k] end setmetatable(o, o) irr.__iguielementproxy[o.__c_class:GetProxy()] = o return o end
imagination304 wrote:Hi all,
I have no experience of using lua.
Will it slow down frame per second of irrlicht?
Thanks in advance
Uhm, when you run the demo, it's one of the optionsimagination304 wrote:Hi zenaku
Thank you for your reply.
One more question: what is the difference between vsync and no vsync?
Thanks in advanceCDemo.lua (no vsync) - Max FPS == 529
CDemo.exe (no vsync) - Max FPS == 573