【发布时间】:2017-08-18 21:20:45
【问题描述】:
我的 LUA 脚本有问题,我正在尝试在 MTA 游戏服务器上创建一个新服务器,并在我的脚本中使用 LUA 语言,但我有一个控制台错误,不知道如何修复它
控制台错误
File.lua 117 Line Error 和文件代码
--The main function to open the entire advertisements system.
function openAdvertisements( player, command ) local advertisements = { } --These will hold our advertisements to send to the client and populate our advertisement tables.
if not player then player = source end
--Fetch all of the advertisements from the database
for _, ad in ipairs( exports.mysql:select('advertisements') ) do
if tonumber( ad.expiry ) >= tonumber( getRealTime().timestamp ) then --Check if the advertisement has expired, delete it if so.
ad.author = exports.mysql:select_one( "characters", { id = ad.created_by } ).charactername
table.insert( advertisements, ad )
else
deleteAdvertisement( ad.id )
end
end
triggerClientEvent( player, resourceName .. ":display_all", root, `advertisements, exports.integration:isPlayerAdmin( player ) ) --Send the` `advertisements to the client to create the GUI.`
第 117 行错误: 对于 _,ipairs 中的广告(exports.mysql:select('advertisements'))做
【问题讨论】:
-
执行“print(exports.mysql:select('advertisements'))”以查看从该 cmd 返回的值。从您的控制台图像来看,cmd 似乎没有按您的预期工作。