|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Wed Jan 19, 2011 6:35 pm
3.33a and LUA |
When these errors arose I was using LuaForWindows_v5.1.4-36. When trying to use LUA with CMUD I started getting strange syntax errors that made no sense. Cmud would complain about the = operator in local variable declarations like the one below.
If I tried to do a loop like the one in the alias below CMUD would give an error about the = operator again.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="test" language="Lua" copy="yes">
<value>a = 0
for i=1,1000 do
a=a+1
end
print(a)
</value>
</alias>
</cmud> |
In the case of the alias, it would run fine if I used a global variable and added a space before and after the = operator in the loop like I have below.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="test" language="Lua" copy="yes">
<value>a = 0
for i = 1,1000 do
a=a+1
end
print(a)
</value>
</alias>
</cmud> |
This was last night. I went to dinner and once back home I updated my LUA with the LuaForWindows_v5.1.4-40 install. I didn't reboot the PC or anything. I started CMUD and all of the sudden I could use local variables again. Also I didn't need to have the spaces before or after the = operator in the loop.
I thought that CMUD used the lua5.1.dll that it was installed with and other installations of LUA were ignored. Since after the update, everything started working right, I question that theory. Was I wrong to think that CMUD only used the .dll it was installed with? |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Jan 20, 2011 6:42 am |
Also, I realize that in both the previous version of LUA I had installed, and the upgraded version, the original syntax I was trying to use for local variable declaration and the loop was correct. This makes the fact the they started working again after the upgrade, make even less sense to me. I know of at least one other person that was having the same problems I described above with LUA and CMUD. They were actually the ones that brought this to my attention, so it's not something specific to my system only.
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Jan 21, 2011 5:28 pm |
I'd be the other user, and I can support what has been said. The Lua I used for a simple process was perfectly valid Lua and yet it ran into so many problems that I simply gave up on it. From errors on the lines with locals to problems with how the for loop was formatted, it simply doesn't feel like it's actually worth it to deal with the all of the hassles that come with making the Lua work with CMUD.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 24, 2011 5:48 pm |
In theory CMUD should only load the lua5.1.dll file that is in the same directory as the CMUD.EXE file. However, Windows can be a bit of a pain when it comes to different versions of DLLs. CMUD is calling the Windows LoadLibrary routine to load the Lua file. It's possible that Windows might load a Lua DLL file from the Windows directory before checking in the same directory as the EXE.
However, if your other Lua DLL was in a completely different directory, then it shouldn't interfere with CMUD unless you tried to run both apps at the same time. If the Lua DLL is already loaded into memory, the LoadLibrary will likely use the version already in memory.
Replacing the Lua DLL file in the CMUD directory with a different version should also normally work. I'm not compiling the Lua DLL myself, I just download it from the Lua web site. So unless they make a big change to their API, CMUD should still work with it. I don't think you need to reboot, but you do need to make sure that anything else using Lua isn't running (so make sure CMUD isn't still running). |
|
|
|
|
|