mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 14:31:17 +00:00
fix posFromString
This commit is contained in:
parent
e7fe4d5051
commit
c861ac14b9
1 changed files with 2 additions and 2 deletions
|
|
@ -296,8 +296,8 @@ module.exports.server = function(serv) {
|
|||
};
|
||||
|
||||
serv.posFromString = (str, pos) => {
|
||||
if (parseInt(str)) return parseInt(str);
|
||||
if (str.match(/~-?\d+/)) return parseInt(str.slice(1)) + pos;
|
||||
if (str.indexOf("~")==-1) return parseFloat(str);
|
||||
if (str.match(/~-?\d+/)) return parseFloat(str.slice(1)) + pos;
|
||||
else if (str == '~') return pos;
|
||||
else throw new UserError('Invalid position');
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue