This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getOS() | |
-- ask LuaJIT first | |
if jit then | |
return jit.os | |
end | |
-- Unix, Linux variants | |
local fh,err = assert(io.popen("uname -o 2>/dev/null","r")) | |
if fh then | |
osname = fh:read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: just call it in a Lua environment and look for a file called out.txt | |
-- lists all global variables in a file | |
function writeAllGlobals() | |
local file = io.open("out.txt", "w+") | |
local seen={} | |
local function dump(t,i) | |
seen[t]=true | |
local s={} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if getOS():lower() == "windows" then | |
for path in io.popen("cd \"data\lib\" && dir *.lua /b/s"):lines() do | |
print(path) -- path = file name/directory | |
end | |
else | |
for path in io.popen("cd data/lib && find . -type f | grep .lua"):lines() do | |
print(path) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void LuaScriptInterface::getIntVector(lua_State* L, int32_t arg, std::vector<uint32_t>& vec) | |
{ | |
lua_pushnil(L); | |
while (lua_next(L, arg) != 0) { | |
if (lua_isnumber(L, -1)) { | |
vec.push_back(lua_tointeger(L, -1)); | |
} | |
lua_pop(L, 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local files = {"door_locked.png", | |
"door_locked_small.png", | |
"door_normal.png", | |
"door_normal_small.png", | |
"door_magic.png", | |
"door_magic_small.png", | |
"door_quest.png", | |
"door_quest_small.png"} | |
function c() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: dumpTable(t) | |
-- to dump to file: | |
--[[ | |
local str = dumpTable(t) | |
local f = io.open("dumped_table.txt", "w+") | |
f:write(str) | |
f:close() | |
]] | |
local function getTabulation(depth) |
You can get downgraded SPR/DAT files from here: https://github.com/EPuncker/1098extended
- Copy them to client directory.
- Download and compile pre-release 1.4.2 from here: https://github.com/Znote/forgottenserver/tree/1.4.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------ | |
-- Loader config | |
------------------------------ | |
local mapGeneratorDir = "data/map_generator/" | |
------------------------------ | |
-- loader | |
------------------------------ | |
dofile(mapGeneratorDir .. 'config.lua') | |
local prefix = ">> " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- no need to redefine this in every script, just paste it to your libs | |
function Position:moveAll(newPos) | |
local tile = Tile(self) | |
if tile then | |
local tileStack = tile:getItems() | |
for _, tileItem in pairs(tileStack) do | |
local itemType = tileItem:getType() | |
if itemType:isMovable() then |
NewerOlder