Which is better?

Post Reply
Reedych
Member
Posts: 58
Joined: Wed Aug 03, 2016 08:09
GitHub: SlackCoyote
In-game: SlackCoyote

Which is better?

by Reedych » Post

Subj

This:

Code: Select all

str = str .. k .. "=" .. v .. ","
or this:

Code: Select all

str = str .. string.format("%s=%s,", k, v)
?

Why minetest lua api doesn't have a class for key-value database (as leveldb) with functions set(), get(), remove()?
Slackware64 14.2, MT 0.4.16. My best mod.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: What is better?

by rubenwardy » Post

Settings() can be used for a file with format the same as minetest.conf
Mod Storage can be used to save arbitrary key-value data

Code: Select all

local storage = minetest.get_mod_storage() -- MUST be called during mod loading!
storage:set_string("a", "b")
storage:get_string("a")
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests