{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreifxxydqedn27s3iob5mixajtiqg7c5co3lxvrbkyv5rhqbcarbj24",
"uri": "at://did:plc:smtxv63bbm7vxyzdgcztykuk/app.bsky.feed.post/3mfvjrb3ls642"
},
"path": "/viewtopic.php?p=449793#p449793",
"publishedAt": "2026-02-27T22:55:20.000Z",
"site": "https://forum.luanti.org",
"tags": [
"ThePropheticWarrior"
],
"textContent": "ModError: Failed to load and run script from C:\\Users\\ThePropheticWarrior\\AppData\\Roaming\\Minetest\\mods\\mobs_api\\init.lua:\n...cWarrior\\AppData\\Roaming\\Minetest\\mods\\mobs_api\\init.lua:181: '}' expected (to close '{' at line 62) near '_mobs_api_health_max'\nCheck debug.txt for details.\n\nHere is what is actually in the file:\n\nfunction mobs_api.register_mob(def)\nif not def.name then return false, \"Needs a name!\" end\nif not def.health_max then return false, \"Needs `health_max = <num>` field!\" end\n\nlocal entity = {\nget_staticdata = function(self)\nlocal table = {}\n\nfor k, v in pairs(self) do\nif not(type(v) == \"userdata\" or type(v) == \"function\") then\ntable[k] = v\nend\nend\n\nreturn core.write_json(table)\nend,\n\non_activate = function(self, staticdata, dtime_s)\nif staticdata and staticdata ~= \"\" then\nlocal table = core.parse_json(staticdata) or {}\nfor k, v in pairs(table) do\nself[k] = v\nend\n\nelseif not self._mobs_api_spawned then\nif self._mobs_api_health_min then\nself.object:set_hp(mobs_api.pr:next(self._mobs_api_health_min, self._mobs_api_health_max))\nend\n\nself._mobs_api_spawned = true\n\nif self._mobs_api_on_spawn then\nself._mobs_api_on_spawn(self)\nend\nend\nend,\n\non_deactivate = function(self, removal)\nif (not removal) and (self._mobs_api_static ~= true) then\nself.object:remove()\nreturn\nend\nend,\n\non_step = function(self, dtime, moveresult)\nif not self._mobs_api_spawned then return end\n\nself._mobs_api_last_step = self._mobs_api_last_step + dtime\n\nif self._mobs_api_last_step >= mobs_api.step_time then\nself._mobs_api_age = self._mobs_api_age + self._mobs_api_last_step\nif self._mobs_api_life_time and self._mobs_api_age >= self._mobs_api_life_time then\nself.object:remove()\nreturn\nend\n\nlocal m_pos = self.object:get_pos()\n\nlocal despawn = true\nfor object in core.objects_inside_radius(m_pos, self._mobs_api_despawn_distance) do\nif object:is_player() then\ndespawn = false\nbreak\nend\nend\nif despawn then\nself.object:remove()\nreturn\nend\n\nif self._mobs_api_chase_distance ~= nil then\nlocal player_to_chase = nil\nfor object in core.objects_inside_radius(self.object:get_pos(), self._mobs_api_chase_distance) do\nif object:is_player() then\nplayer_to_chase = object\nbreak\nend\nend\n\nif player_to_chase ~= nil then\nlocal p_pos = player_to_chase:get_pos()\nlocal dir = p_pos - m_pos\nlocal mag = math.sqrt(dir.x*dir.x + dir.y*dir.y + dir.z*dir.z)\n\nif mag > 2 then\nlocal v = vector.new(dir.x / mag, dir.y / mag, dir.z / mag)\nself.object:set_velocity(v * self._mobs_api_walk_speed + vector.new(0, self._mobs_api_gravity, 0))\nif self._mobs_api_on_chase ~= nil then\nself._mobs_api_on_chase(self, player_to_chase)\nend\n\nelse\nself.object:set_velocity(vector.new(0, self._mobs_api_gravity, 0))\nif self._mobs_api_on_at_player ~= nil then\nself._mobs_api_on_at_player(self, player_to_chase)\n\nelseif self._mobs_api_on_stop ~= nil then\nself._mobs_api_on_stop(self)\nend\nend\n\nelse\nself.object:set_velocity(vector.new(0, self._mobs_api_gravity, 0))\n\nif self._mobs_api_on_idle ~= nil then\nself._mobs_api_on_idle(self)\nend\nend\nend\n\n\nif self._mobs_api_on_step ~= nil then\nself._mobs_api_on_step(self, dtime, moveresult)\nend\n\nself._mobs_api_last_step = 0\nend\nend,\n\non_punched = def.on_punched,\non_rightclick = def.on_rightclick\n\n-- Vars\n_mobs_api_health_max = def.health_max,\n_mobs_api_static = def.static,\n_mobs_api_despawn_distance = def.despawn_distance or 32,\n_mobs_api_chase_distance = def.chase_distance,\n_mobs_api_walk_speed = def.walk_speed or 1,\n_mobs_api_gravity = -(def.gravity or 0),\n_mobs_api_spawned = false,\n_mobs_api_last_step = 0,\n_mobs_api_age = 0,\n\n-- Callbacks\n_mobs_api_on_spawn = def.on_spawn,\n_mobs_api_life_time = def.life_time,\n_mobs_api_on_step = def.on_step,\n_mobs_api_on_chase = def.on_chase,\n_mobs_api_on_stop = def.on_stop,\n_mobs_api_on_at_player = def.on_at_player,\n_mobs_api_on_idle = def.on_idle,\n\n\n_mobs_api_spawned = false,\n}\n\nIt is definately there, at the end of above text - at line 282 (using Notepad++)! What, is it too far away or something?\n\nI think either Lua needs to be updated, or Luanti needs help!\n\nStatistics: Posted by ThePropheticWarrior — Fri Feb 27, 2026 22:55\n\n* * *",
"title": "Problems • "The Mob API" Crash on start",
"updatedAt": "2026-02-28T01:52:18.000Z"
}