I get an error when I run ingame it says
also posted source on pastebin SOURCE
The place where the error happens:
menu1 = menu1 or {
{ text = "Cancel", is_cancel_button = true }
{},
{ text = "+G0DM0DE~", callback = godmode }
{ text = "+Stamina Hack~", callback = staminahx }
{ text = "+Equipment/Tie Hack~", callback = sawsandties }
{ text = "No Recoil Or Spread!", callback = norclorsprd }
{ text = "< - Back", callback = callmenu0 },
}
You need to add comma between each elements of the table:
menu1 = menu1 or {
{ text = "Cancel", is_cancel_button = true }, --here
{},
{ text = "+G0DM0DE~", callback = godmode }, --here
{ text = "+Stamina Hack~", callback = staminahx }, --here
{ text = "+Equipment/Tie Hack~", callback = sawsandties }, --here
{ text = "No Recoil Or Spread!", callback = norclorsprd }, --here
{ text = "< - Back", callback = callmenu0 },
}
Related
local test = {
{
Resource = "test",
},
},
How can I add a table inside another table? so it will look like this
local test = {
{
Resource = "test",
{
File = "this is a test",
Code = "this is a test",
},
{
File = "this is a test",
Code = "this is a test",
},
},
}
Umm im only writing this because this post is mostly code and therefore have to put more text.
so please ignore this part :) and good new year
local test = {
{
Resource = "test",
},
}
for i = 1,2 do
test[1][i] = {
File = "this is a test",
Code = "this is a test",
}
end
or
for _ = 1,2 do
table.insert(test[1], {
File = "this is a test",
Code = "this is a test",
}
end
The following code is for an escape menu in a garrys mod server. It's written in lua. I have no idea what the problem could be and I've been working at it for a very long time. There is absolutely no error returned. Here's the full thing:
local buttonList = {
{
name = "Continue",
callback = function(panel)
panel:Remove();
Atomic.pauseUI = nil;
end
},
{
name = "Menu",
callback = function(panel)
panel:Remove();
gui.ActivateGameUI();
Atomic.showDefaultMenu = true;
Atomic.delayCheck = true;
end
},
--[[
{
name = "Settings",
callback = function(panel)
// panel:Remove();
end
},
--]]
{
name = "Rules",
callback = function(panel)
gui.OpenURL("https://steamcommunity.com/linkfilter/?url=https://facepunch.com")
end;
},
{
name = "Disconnect",
callback = function(panel)
RunConsoleCommand("disconnect");
end
}
};
I want to add table 'mm' to table 'fmenu.pages' but it doesnt work at all. Error: attempt to index a nil value (field 'main2'). Its about last line. Code:
local fmenu = {
selected_button = 0,
menu = {
font = 1,
},
pages = {
["main"] = {
name = "name",
id = 1,
btns = {
{name = "name I", id = 1}
}
}
}
}
local mm = {
["main2"] = {
name = "name2",
id = 2,
btns = {
{name = "name I", id = 1},
{name = "name II", id = 2}
}
}
}
table.insert(fmenu.pages, mm)
print(fmenu.pages["main2"].name)
How about using table.merge from lua-stdlib?
local table = require"std.table"
local fmenu = {
selected_button = 0,
menu = {
font = 1,
},
pages = {
["main"] = {
name = "name",
id = 1,
btns = {
{name = "name I", id = 1}
}
}
}
}
local mm = {
["main2"] = {
name = "name2",
id = 2,
btns = {
{name = "name I", id = 1},
{name = "name II", id = 2}
}
}
}
table.merge(fmenu.pages, mm)
print(fmenu.pages["main2"].name)
error row not found for index at app
i am working on this code
if i will click first time table view row it will show the error
but it will show the child row.
2.and if i will click the child row this error will show : undefined is not an object
(evaluating (e.row.sub.length)
why i am getting this error?
code
var win = Ti.UI.createWindow();
var container = Ti.UI.createView({ backgroundColor: "white", layout: "vertical" });
var layout = [{
title: "Parent 1",
isparent: true,
opened: false,
sub: [
{ title: "Child 1" },
{ title: "Child 2" }
]
}, {
title: "Parent 2",
isparent: true,
opened: false,
sub: [
{ title: "Child 3" },
{ title: "Child 4" }
]
}];
var tableView = Ti.UI.createTableView({
style: Titanium.UI.iPhone.TableViewStyle.GROUPED,
top: 0,
height: Ti.Platform.displayCaps.platformHeight,
data: layout
});
tableView.addEventListener("click", function (e) {
var i;
//Is this a parent cell?
console.log(e.row);
if (e.row.isparent) {
//Is it opened?
if (e.row.opened) {
for (i = e.row.sub.length; i > 0; i = i - 1) {
tableView.deleteRow(e.index + i);
}
e.row.opened = false;
} else {
//Add teh children.
var currentIndex = e.index;
for (i = 0; i < e.row.sub.length; i++) {
tableView.insertRowAfter(currentIndex, e.row.sub[i]);
currentIndex++;
}
e.row.opened = true;
}
}
});
container.add(tableView);
win.add(container);
win.open();
Any help would be appreciated
Problem with your code is that you are trying to insert many rows at the end of the table when table index wasn't updated yet. The solution for it is to add rows in reverse order using same index.
Here is modified version of your event listener:
tableView.addEventListener("click", function (e) {
var i, rows;
//Is this a parent cell?
if (e.row.isparent) {
//Is it opened?
if (e.row.opened) {
for (i = e.row.sub.length; i > 0; i = i - 1) {
tableView.deleteRow(e.index + i);
}
e.row.opened = false;
} else {
//Add teh children.
rows = e.row.sub.reverse();
for (i = 0; i < rows.length; i++) {
tableView.insertRowAfter(e.index, rows[i]);
}
e.row.opened = true;
}
}
});
I have 2 buttons that are in a popup.when each button clicked, popup perform callback .
my problem is when popup make callback i want to know which button clicked and Causes callback
i wrote this code but it don't work , Because in BeginCallback property S.name is the name of popup also e.buttonID is null Because Html.DevExpress().Button dont render input with button type ,it render td and div tag
please help me.
#Html.DevExpress().PopupControl(
settings =>
{
settings.Name = "GetDatepopUp";
settings.PopupElementID = "GetDate";
settings.PopupAction = PopupAction.LeftMouseClick;
settings.CloseAction = CloseAction.CloseButton;
settings.Modal = true;
settings.ShowOnPageLoad = false;
settings.LoadContentViaCallback = LoadContentViaCallback.OnPageLoad;
settings.SetContent(() =>
{
#Html.RenderPartial("CalenderContainerPartialView", "Message");
});
settings.CallbackRouteValues =
new { Controller = "Message", Action = "Calender" };
settings.ClientSideEvents.BeginCallback =
"function(s,e) { e.customArgs['btnName'] = s.name; }";
settings.SetFooterTemplateContent(c =>
{
ViewContext.Writer.Write("<Table style='width:100%'><tr><td>");
Html.DevExpress().Button(buttonsettings =>
{
buttonsettings.Name = "btnNext";
buttonsettings.Text = "<<";
buttonsettings.ClientSideEvents.Click =
"function(s, e) { GetDatepopUp.PerformCallback(); }";
}).Render();
ViewContext.Writer.Write("</td><td>");
Html.DevExpress().Button(buttonsettings =>
{
buttonsettings.Name = "btnPrevious";
buttonsettings.Text = ">>";
buttonsettings.ClientSideEvents.Click =
"function(s, e) { GetDatepopUp.PerformCallback(); }";
}).Render();
ViewContext.Writer.Write("</td></tr></table>");
});
}).GetHtml()
try changing:
GetDatepopUp.PerformCallback();
to this:
GetDatepopUp.PerformCallback('btnPrevious');