Skip to content
Snippets Groups Projects
Commit 79f399d9 authored by DarkGod's avatar DarkGod
Browse files

fix, good lua

parent a7931e1f
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -32,17 +32,18 @@ frame_oy2 = 15
--- @string text
-- @int[opt=60] dur
-- @param[opt=colors.Black] color
function _M:init(text, dur, color)
function _M:init(text, dur, color, font)
self.text = text
self.dur = dur or 60
self.color = color or colors.BLACK
self.use_font = font
Base.init(self, {font = {"/data/font/DroidSans-Bold.ttf", 16}})
Base.init(self, {font = self.use_font or {"/data/font/DroidSans-Bold.ttf", 16}})
end
--- on loaded
function _M:loaded()
Base.init(self, {font = {"/data/font/DroidSans-Bold.ttf", 16}})
Base.init(self, {font = self.use_font or {"/data/font/DroidSans-Bold.ttf", 16}})
end
--- Serialization
......@@ -61,6 +62,7 @@ end
function _M:generate()
-- Draw UI
local w, h = self.font:size(self.text)
w=w*1.1
self.w, self.h = w - frame_ox1 + frame_ox2, h - frame_oy1 + frame_oy2
local s = core.display.newSurface(w, h)
......
......@@ -1081,9 +1081,9 @@ function _M:triggerTalent(tid, name, ...)
name = name or "trigger"
if t[name] then
self.__talent_running = t
local r1, r2, r3, r4, r5, r6, r7, r8 = t[name](self, t, ...)
local ret = {t[name](self, t, ...)}
self.__talent_running = nil
return r1, r2, r3, r4, r5, r6, r7, r8 -- UHHHHHHHH :/ but unpack() doesnt work with nils in the list and it's quite possible some talent does return things this way
return unpack(ret, 1, table.maxn(ret))
end
end
......@@ -1093,9 +1093,9 @@ function _M:callTalent(tid, name, ...)
name = name or "trigger"
if t[name] then
self.__talent_running = t
local r1, r2, r3, r4, r5, r6, r7, r8 = t[name](self, t, ...)
local ret = {t[name](self, t, ...)}
self.__talent_running = nil
return r1, r2, r3, r4, r5, r6, r7, r8 -- UHHHHHHHH :/ but unpack() doesnt work with nils in the list and it's quite possible some talent does return things this way
return unpack(ret, 1, table.maxn(ret))
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment