• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved How to change TFS Lua liabriaries?

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,454
Solutions
1
Reaction score
627
Location
Estonia
I'm using TFS 1.2

I am trying to set up my server again. This time in Linux. I'm almost there, but now I have lot of errors with my codes.

All my scripts are written for Lua 5.1 version. Apparently the new source is using Lua version 5.2

What I have to do, to change the Lua version what TFS uses to 5.1?
If that cant be done without breaking something else in source.
What is latest repo/branch/version(no idea what they called) of TFS what uses Lua 5.1?

I don't see any reason why should go with lua version 5.2.
Only thing what it does is: months of unknown errors what needs to be changed in code (what perfectly worked in 5.1 version)
 
Last edited:
Because it's newer. Can you post some of these errors?
Some of the Lua errors? they don't concern me, because I know how to fix them. The fact that I have to go trough entire datapack and update my code is simply a huge task.
At current state. Practically everything what happens in game is ran trough a custom Lua script. It may take lot of time and errors to get them working smoothly.

Half a year ago or so when I updated from TFS 1.0 to 1.1 I had errors and crashes for 2 months before everything seemed to start working again.
I would like to avoid something like that again, because now I have 5 times more custom content then I had before.
But for an example, what happened when I started up my server. First error was something like: "invalid key to next" (as the next it didn't mean variable it meant the Lua loop thing for k,v in pairs())
I went to code and looked whats the problem:
Code:
for A, B in pairs(t) do
                if A > B then
                    xPosT[vertPos][A] = nil
                    xPosT[vertPos][B] = A
                end
            end
simple fix:
Code:
for A, B in pairs(t) do
                if A > B then
                    xPosT[vertPos][B] = A
                    xPosT[vertPos][A] = nil
                end
            end
And it works. But who knows what other scripts don't work. They might start causing crashes without errors and then good luck me finding these.
As of right now I'm actually already changing my codes, because no idea, how long it will take to find solution to use lua libs 5.1 for linux, if its even simple matter.

------
The reason why same source and files work on my test server (which is compiled for windows 7) is this: https://github.com/otland/forgottenserver/blob/master/vc14/settings.props#L13
Perhaps it will give some idea how to hax the previous Lua version in for linux too?

I have already tried to uninstall lualib5.2 and using different version on lualib5.1 and compile the sources. But every time I get this error:
Code:
root@raspberrypi:/home/pi/forgottenserver/build# cmake ..
-- cotire 1.7.6 loaded.
-- MySQL Include dir: /usr/include/mysql  library dir: /usr/lib/arm-linux-gnueabihf
-- MySQL client libraries: mysqlclient
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/forgottenserver/build
root@raspberrypi:/home/pi/forgottenserver/build# make
[  1%] Building CXX object CMakeFiles/tfs.dir/src/actions.cpp.o
In file included from /home/pi/forgottenserver/src/baseevents.h:23:0,
                 from /home/pi/forgottenserver/src/actions.h:23,
                 from /home/pi/forgottenserver/src/actions.cpp:22:
/home/pi/forgottenserver/src/luascript.h:23:19: fatal error: lua.hpp: No such file or directory
#include <lua.hpp>
                   ^
compilation terminated.
CMakeFiles/tfs.dir/build.make:95: recipe for target 'CMakeFiles/tfs.dir/src/actions.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/actions.cpp.o] Error 1
CMakeFiles/Makefile2:122: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

When I compile the server (with lualib5.2) and delete it after.
I cant run the ./tfs because of missing lualib5.2 :D
 
Some of the Lua errors? they don't concern me, because I know how to fix them. The fact that I have to go trough entire datapack and update my code is simply a huge task.
At current state. Practically everything what happens in game is ran trough a custom Lua script. It may take lot of time and errors to get them working smoothly.

Half a year ago or so when I updated from TFS 1.0 to 1.1 I had errors and crashes for 2 months before everything seemed to start working again.
I would like to avoid something like that again, because now I have 5 times more custom content then I had before.
But for an example, what happened when I started up my server. First error was something like: "invalid key to next" (as the next it didn't mean variable it meant the Lua loop thing for k,v in pairs())
I went to code and looked whats the problem:
Code:
for A, B in pairs(t) do
                if A > B then
                    xPosT[vertPos][A] = nil
                    xPosT[vertPos][B] = A
                end
            end
simple fix:
Code:
for A, B in pairs(t) do
                if A > B then
                    xPosT[vertPos][B] = A
                    xPosT[vertPos][A] = nil
                end
            end
And it works. But who knows what other scripts don't work. They might start causing crashes without errors and then good luck me finding these.
As of right now I'm actually already changing my codes, because no idea, how long it will take to find solution to use lua libs 5.1 for linux, if its even simple matter.

------
The reason why same source and files work on my test server (which is compiled for windows 7) is this: https://github.com/otland/forgottenserver/blob/master/vc14/settings.props#L13
Perhaps it will give some idea how to hax the previous Lua version in for linux too?

I have already tried to uninstall lualib5.2 and using different version on lualib5.1 and compile the sources. But every time I get this error:
Code:
root@raspberrypi:/home/pi/forgottenserver/build# cmake ..
-- cotire 1.7.6 loaded.
-- MySQL Include dir: /usr/include/mysql  library dir: /usr/lib/arm-linux-gnueabihf
-- MySQL client libraries: mysqlclient
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/forgottenserver/build
root@raspberrypi:/home/pi/forgottenserver/build# make
[  1%] Building CXX object CMakeFiles/tfs.dir/src/actions.cpp.o
In file included from /home/pi/forgottenserver/src/baseevents.h:23:0,
                 from /home/pi/forgottenserver/src/actions.h:23,
                 from /home/pi/forgottenserver/src/actions.cpp:22:
/home/pi/forgottenserver/src/luascript.h:23:19: fatal error: lua.hpp: No such file or directory
#include <lua.hpp>
                   ^
compilation terminated.
CMakeFiles/tfs.dir/build.make:95: recipe for target 'CMakeFiles/tfs.dir/src/actions.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/actions.cpp.o] Error 1
CMakeFiles/Makefile2:122: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

When I compile the server (with lualib5.2) and delete it after.
I cant run the ./tfs because of missing lualib5.2 :D

You have to delete the folder build and execute cmake again.
 
You have to delete the folder build and execute cmake again.
That worked.

If this doesn't work for somebody else. Then delete you entire Forgotten Server folder.
You don't need to setup database or anything anymore. You just make new git clone and build again, but this time with lualib5.1

Well since now I have error free server again (until next patch xD) I can soon put it back to live.

Ty for all. This Linux has been hard road for me x)
 
Back
Top