aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-03 11:41:52 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-03 11:41:52 +0200
commit760416b81fbcf3343d4276c20cf7d6028b5ad461 (patch)
treee60c8a16cf63b2b71721595cdc9f65e1d0271656 /src
parent1c785c32ef9290b5a461a6ec21b27b3621cb48a7 (diff)
downloadminetest-760416b81fbcf3343d4276c20cf7d6028b5ad461.tar.gz
minetest-760416b81fbcf3343d4276c20cf7d6028b5ad461.tar.bz2
minetest-760416b81fbcf3343d4276c20cf7d6028b5ad461.zip
Change naming convention to be modname:* instead of modname_* (sorry modders!)
Diffstat (limited to 'src')
-rw-r--r--src/scriptapi.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index be1366737..c9f132f4a 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -153,11 +153,18 @@ void check_modname_prefix(lua_State *L, std::string &name)
// For __builtin, anything goes
if(modname == "__builtin")
return;
-
- if(name.substr(0, modname.size()+1) != modname + "_")
+
+ if(name.substr(0, modname.size()+1) != modname + ":")
+ throw LuaError(L, std::string("Name \"")+name
+ +"\" does not follow naming conventions: "
+ +"\"modname:\" or \":\" prefix required)");
+
+ std::string subname = name.substr(modname.size()+1);
+ if(!string_allowed(subname, "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"))
throw LuaError(L, std::string("Name \"")+name
+"\" does not follow naming conventions: "
- +"\"modname_\" or \":\" prefix required)");
+ +"\"contains unallowed characters)");
}
static v3f readFloatPos(lua_State *L, int index)