conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Hide the widget when the frame is destroyed\n" }, { "from": "human", "value": "require \"wow/Frame\";\nrequire \"rainback/AnchoredBound\";\nrequire \"rainback/wow-conversion\";\n\nlocal Widget = OOP.Class(WoW.Frame);\nWoW.Widget = Widget;\nWoW.RegisterFrameType(\"Wi...
lua
chosen
[ { "from": "human", "value": "Update module for save and load settings from files\n" }, { "from": "gpt", "value": "local loadsave = require( 'lib.loadsave')\n\nlocal M = {}\n\nM.settings = {}\n\nfunction M:save()\n\tloadsave.saveTable( self.settings, 'settings.json' )\nend\t\n\nfunction M:get( na...
lua
chosen
[ { "from": "system", "value": "Revert \"Enable disabling of persistent replacements\"\n\nThis reverts commit f8f47b37f9182774f235f6bc00816b3e05bb82b4.\n" }, { "from": "human", "value": "local CircularBuffer = require (\"circularbuffer\")\n\nsed = sed or {}\nsed.messages = CircularBuffer (20)\n\nl...
lua
chosen
[ { "from": "system", "value": "Support empty fragmenets like a{,b}c\n" }, { "from": "human", "value": "local orgfilter = nyagos.filter\r\nnyagos.filter = function(cmdline)\r\n if orgfilter then\r\n cmdline = orgfilter(cmdline)\r\n end\r\n local last\r\n repeat\r\n last =...
lua
chosen
[ { "from": "human", "value": "Add new Util module, w/ Util.seqRemove() to remove an item from a sequence\n" }, { "from": "gpt", "value": "\n--\n--\tactor.lua\n--\tGeneric utility functions not belonging anywhere else\n--\n\nlocal Util = {}\n\n--\tUtil.seqDelete() - removes an object from a numeri...
lua
chosen
[ { "from": "system", "value": "Make Sprite class not error when frames cannot be loaded.\n" }, { "from": "human", "value": "require 'class'\nrequire 'dozipfile'\n\nclass 'Sprite' \n\nfunction Sprite:__init( file_base_name )\n self.bitmaps = {}\n self.frames = {}\n self:addFrames( file_ba...
lua
chosen
[ { "from": "system", "value": "Tweak header and add bottom folio frame to royaloctavo\n" }, { "from": "human", "value": "CASILE.layout = \"royaloctavo\"\n\nlocal class = SILE.documentState.documentClass\n\nSILE.documentState.paperSize = SILE.paperSizeParser(\"165mm x 250mm\")\nSILE.documentState....
lua
chosen
[ { "from": "system", "value": "Fix frame name being hard coded in outputFolio()\n" }, { "from": "human", "value": "-- Folios class\nSILE.require(\"packages/counters\")\nSILE.scratch.counters.folio = { value = 1, display = \"arabic\" }\n\nSILE.registerCommand(\"folios\", function () SILE.scratch.c...
lua
chosen
[ { "from": "system", "value": "[hs] Make cli install more robust\n" }, { "from": "human", "value": "require 'expandmode'\nrequire 'movemode'\n\nrequire 'hs.alert'\nrequire \"hs.ipc\"\nhs.ipc.cliInstall()\n\nlocal super = {'ctrl', 'alt', 'cmd', 'shift'}\n" }, { "from": "gpt", "value": ...
lua
chosen
[ { "from": "system", "value": "Update Generator project build file to new Premake filter syntax.\n" }, { "from": "human", "value": "project \"CppSharp.Generator\"\n\n SetupManagedProject()\n\n kind \"SharedLib\"\n language \"C#\"\n\n files { \"**.cs\", \"**verbs.txt\" }\n excludes { \"Filt...
lua
chosen
[ { "from": "system", "value": "Fix requires in model shower\n" }, { "from": "human", "value": "require 'paths'\nrequire 'nn'\nrequire 'cutorch'\nrequire 'cunn'\nrequire 'LeakyReLU'\nrequire 'dpnn'\nrequire 'layers.cudnnSpatialConvolutionUpsample'\nrequire 'stn'\n\nOPT = lapp[[\n --save ...
lua
chosen
[ { "from": "human", "value": "Add consequence for gem crafting\n" }, { "from": "gpt", "value": "require(\"base.class\")\nrequire(\"npc.base.consequence.consequence\")\nrequire(\"item.gems\")\n\nmodule(\"npc.base.consequence.gemcraft\", package.seeall)\n\ncraft = base.class.class(npc.base.conseque...
lua
chosen
[ { "from": "system", "value": "Add karaoke-player to hi-linux build\n" }, { "from": "human", "value": "-- HiSilicon Linux SDK\n\npackage { 'make', 'host',\n source = 'make-3.81.tar.bz2'\n}\n\npackage { 'hi-kernel' }\n\npackage { 'hi-sdk', 'target',\n { 'build_linux',\n { 'hi-kernel',...
lua
chosen
[ { "from": "human", "value": "Add test of cq:close() behaviour\n" }, { "from": "gpt", "value": "#!/bin/sh\n_=[[\n\t. \"${0%%/*}/regress.sh\"\n\texec runlua \"$0\" \"$@\"\n]]\nrequire\"regress\".export\".*\"\n\nlocal cq = require\"cqueues\".new()\ncq:close()\ncheck(not pcall(cq.wrap, cq), \"cqueue...
lua
chosen
[ { "from": "system", "value": "Build/SdkServer: Fix Console.cpp being included in the project\n\n\nFormer-commit-id: 62d706654c398a60946282e112d7e139107ac745" }, { "from": "human", "value": "TOOL.Name = \"SDKServer\"\n\nTOOL.Directory = \"../SDK/lib\"\nTOOL.Kind = \"Library\"\n\nTOOL.Defines = {\...
lua
chosen
[ { "from": "system", "value": "Fix a variable name typo in the lua ffi example module.\n" }, { "from": "human", "value": "----------------------------------------------------------------------------\n-- Define local versions of globals that will be used\n------------------------------------------...
lua
chosen
[ { "from": "system", "value": "Make delay use a tail call.\n" }, { "from": "human", "value": "yield = coroutine.yield\n\nfunction print( ... )\n local printResult = '';\n\n for i,v in ipairs( {...} ) do\n printResult = printResult .. tostring( v ) .. \"\\t\"\n end\n printResult...
lua
chosen
[ { "from": "system", "value": "Use sha256 in non js part\n" }, { "from": "human", "value": "local Loader = require \"cosy.loader\"\n\nif _G.js then\n local script = Loader.loadhttp \"/js/sjcl.js\"\n --_G.js.global:eval (script)\n window.jQuery:globalEval (script)\n return function (s)\n lo...
lua
chosen
[ { "from": "system", "value": "Use markdown for the link to the effects enum." }, { "from": "human", "value": "--- Provides functions to spawn particles.\r\n-- @module rpgplus.particle\r\n\r\n--- Spawns particles at the given location\r\n-- @param location location\r\n-- @param effect effect as s...
lua
chosen
[ { "from": "system", "value": "Remove hover effect from frame\n" }, { "from": "human", "value": "local Rectangle = require(\"Rectangle\")\nlocal renderutils = require(\"Renderutils\")\nlocal Frame = {}\n\nlocal quads = renderutils.border_quads(48, 0, 16, 16, 128, 128, 2)\n\nFrame.start = function...
lua
chosen
[ { "from": "human", "value": "Add train stops schedule toy script\n\n" }, { "from": "gpt", "value": "/c\nfunction shuffle(list)\n\tfor i = #list, 2, -1 do\n\t\tlocal j = math.random(i);\n\t\tlist[i], list[j] = list[j], list[i];\n\tend\nend\n\nlocal train = game.player.vehicle.train;\nlocal schedu...
lua
chosen
[ { "from": "system", "value": "Replace path in example by relative path\n" }, { "from": "human", "value": "return {\n _META = {\n image_path = \"/Users/moritz/Projects/Quadtastic/example/res/sheet.png\",\n },\n base = {x = 16, y = 27, w = 16, h = 8},\n bubbles = {\n {x = 2, y = 18, w = ...
lua
chosen
[ { "from": "system", "value": "Clean up job pool when finishing job.\n" }, { "from": "human", "value": "local working_set, done_set, job_pool = unpack(KEYS)\nlocal timestamp = ARGV[1]\ntable.remove(ARGV, 1)\nlocal unique_keys = ARGV\n\nif next(unique_keys) == nil then\n return {}\nend\n\nlocal...
lua
chosen
[ { "from": "system", "value": "Add the new generator tests project to the master build.\n" }, { "from": "human", "value": "-- This is the starting point of the build scripts for the project.\n-- It defines the common build settings that all the projects share\n-- and calls the build scripts of al...
lua
chosen
[ { "from": "system", "value": "Add folio fram to A5trim and normalize with other layouts\n" }, { "from": "human", "value": "local book = SILE.require(\"classes/book\");\nbook:loadPackage(\"masters\")\nbook:defineMaster({ id = \"right\", firstContentFrame = \"content\", frames = {\n content = { l...
lua
chosen
[ { "from": "system", "value": "Clean up and add comments\n" }, { "from": "human", "value": "-- Set the Lua module search path\npackage.path = './lua/?.lua'\n\nlocal viewport = require 'engine.viewport'\nviewport.create(1280, 720, 'test')\nviewport.addNode(require 'imgui')\nviewport.run()\n" }, ...
lua
chosen
[ { "from": "system", "value": "Remove debug prints and restructure stuff\n" }, { "from": "human", "value": "io.write(\"Here i go again\\n\");\ninput.create(\"horizontal\",\t-- name\n\t false, \t\t-- invert?\n\t 0.1, \t\t-- deadzone, negative direction\n\t 0.1,\t\t-- deadzone, positive...
lua
chosen
[ { "from": "human", "value": "Add crash script for debugging core dump creation\n" }, { "from": "gpt", "value": "--[[\nIllarion Server\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSof...
lua
chosen
[ { "from": "system", "value": "Put mapper and reducer out main example function for performance reasons.\n" }, { "from": "human", "value": "function sum_single_bin(s)\n\n local function mapper(rec)\n \treturn rec['aggbin']\n end\n\n local function reducer(val1, val2)\n return v...
lua
chosen
[ { "from": "system", "value": "Build/UnitTest: Fix linking against Network module\n\n\nFormer-commit-id: 69422c73fa14328306e372346a2bae2ead5412e0 [formerly bbff8882d6c5b8eb811a04f4f0561161d93dd2aa]\nFormer-commit-id: 33a1050adac4332ae0c3e9a68c0f5294253a7cc0" }, { "from": "human", "value": "TOOL.N...
lua
chosen
[ { "from": "system", "value": "Bring cep layout up to speed with changes to build system\n" }, { "from": "human", "value": "local book=SILE.require(\"classes/book\");\n\nSILE.documentState.paperSize = SILE.paperSizeParser(\"110mm x 170mm\")\nSILE.documentState.orgPaperSize = SILE.documentState.pa...
lua
chosen
[ { "from": "system", "value": "Refactor away G variable in sample06.\n" }, { "from": "human", "value": "-- This is an example to demonstrate embedding l2l in another lua program.\n-- Run using: lua sample06/embed.lua\n\nlocal core = require(\"core\")\n\n\nlocal obj = core.read(core.reader.tofile(...
lua
chosen
[ { "from": "system", "value": "Add mapping to close Spectre\n" }, { "from": "human", "value": "vim.api.nvim_set_keymap(\"n\", \"<leader>S\", \":lua require('spectre').open()<CR>\", { noremap = true })\n-- search current word\nvim.api.nvim_set_keymap(\"n\", \"<leader>sw\", \":lua require('spectre'...
lua
chosen
[ { "from": "system", "value": "Delete SSH keys from agent upon screen lock via ssh-agent-ctrl\n\n See script here:\n https://github.com/antontsv/home.bin/blob/master/bin/ssh-agent-ctrl\n" }, { "from": "human", "value": "function ScreenLockWatcher()\n local self={}\n\n -- Do some actions upo...
lua
chosen
[ { "from": "system", "value": "Add jid support for motd\n" }, { "from": "human", "value": "-- Prosody IM\n-- Copyright (C) 2008-2010 Matthew Wild\n-- Copyright (C) 2008-2010 Waqas Hussain\n-- Copyright (C) 2010 Jeff Mitchell\n-- \n-- This project is MIT/X11 licensed. Please see the\n-- COPYING fi...
lua
chosen
[ { "from": "system", "value": "Add translations messages for server commands.\n" }, { "from": "human", "value": "return {\n [\"message:invalid\"] = {\n en = \"rpc message is invalid\",\n },\n [\"server:action\"] = {\n en = \"start or stop\",\n },\n [\"flag:clean\"] = {\n en = \"clea...
lua
chosen
[ { "from": "system", "value": "Example: Fix compilation of Tut00 after Physics change\n\nHad some trouble with spaces" }, { "from": "human", "value": "EXAMPLE.Name = \"Tut00_EmptyProject\"\n\nEXAMPLE.EnableConsole = true\n\nEXAMPLE.Files = {\n\t\"main.cpp\"\n}\n\nEXAMPLE.Libraries = {\n \"Naza...
lua
chosen
[ { "from": "system", "value": "Update coro-http test and add basic https test\n" }, { "from": "human", "value": "local http = require 'coro-http'\n\nrequire('tap')(function (test)\n\n test(\"real http request\", function ()\n coroutine.wrap(function()\n local res, data = http.request('GE...
lua
chosen
[ { "from": "system", "value": "nvim: Install lightline and edge colorscheme\n\nNord is kinda bland. lightline.vim gets the job done for now and does\nnot require configuration like feline.\n" }, { "from": "human", "value": "require(\"packer\").startup(function()\n use 'wbthomason/packer.nvim'\...
lua
chosen
[ { "from": "system", "value": "Rename lit name to luvit/lit\n" }, { "from": "human", "value": "return {\n name = \"creationix/lit\",\n version = \"1.1.1\",\n luvi = {\n version = \"2.0.1\",\n flavor = \"regular\",\n },\n dependencies = {\n \"luvit/require@1.0.1\",\n \"luvit/prett...
lua
chosen
[ { "from": "system", "value": "Add example code to merge the two layers.\n" }, { "from": "human", "value": "local Serpent = require \"serpent\"\nlocal function dump (x)\n return Serpent.dump (x, {\n indent = \" \",\n comment = false,\n sortkeys = true,\n compact = false,\n })\n...
lua
chosen
[ { "from": "system", "value": "Add a NAME to each tag.\n" }, { "from": "human", "value": "-- Tags\n-- ====\n\n-- Internal mechanisms require to store some information in the data. In\n-- order to avoid name conflicts with user defined keys, we use tables as\n-- keys for internal information. Such...
lua
chosen
[ { "from": "system", "value": "Premake: Use lib instead of stlsplit to ensure build order\n" }, { "from": "human", "value": "#!lua\n\nsolution \"stlsplit\"\n\tlocation ( \".\" )\n\ttargetdir(\"build\")\n\tconfigurations { \"Debug\", \"Release\" }\n\tplatforms {\"native\", \"x64\", \"x32\"}\n\n\tc...
lua
chosen
[ { "from": "system", "value": "Add hyper+space for window cycling\n" }, { "from": "human", "value": "local function pressFn(mods, key)\n if key == nil then\n key = mods\n mods = {}\n end\n return function() hs.eventtap.keyStroke(mods, key, 1000) end\nend\n\nlocal function remap(mods, key...
lua
chosen
[ { "from": "system", "value": "Add nonstandard MICROSOFT_WINDOW handle struct\n" }, { "from": "human", "value": "\nlocal ffi = require 'ffi'\n\nffi.cdef [[\n\t\n\ttypedef struct RESOURCE_UPDATE_W RESOURCE_UPDATE_W;\n\ttypedef struct RESOURCE_UPDATE_A RESOURCE_UPDATE_A;\n\n\ttypedef struct MODULE ...
lua
chosen
[ { "from": "system", "value": "Add a lower command too." }, { "from": "human", "value": "SILE.registerCommand(\"raise\", function(options, content)\n local height = options.height or 0\n height = SILE.parseComplexFrameDimension(height,\"h\")\n SILE.typesetter:pushHbox({ \n outputYourself= f...
lua
chosen
[ { "from": "system", "value": "Use 'Nodes' instead of 'Containers' in LUA file\n" }, { "from": "human", "value": "-- DAG definition: it is encoded as an array of stages.\nStages = @@STAGES@@;\n\n-- Number of computation nodes in the system\nContainers = @@CONTAINERS@@;\n\n-- Number of users acces...
lua
chosen
[ { "from": "system", "value": "Add more test cases with counts (now fails).\n" }, { "from": "human", "value": "-- Test the change word command\ntest.open('words.txt')\nlocal lineno = test.lineno\nlocal colno = test.colno\nlocal assertEq = test.assertEq\ntest.key('j')\nassertEq(colno(), 0)\nassert...
lua
chosen
[ { "from": "system", "value": "Put a reasonable maximum size on widgets\n" }, { "from": "human", "value": "require \"wow/Frame\";\nrequire \"rainback/AnchoredBound\";\nrequire \"rainback/wow-conversion\";\n\nlocal Widget = OOP.Class(WoW.Frame);\nWoW.Widget = Widget;\nWoW.RegisterFrameType(\"Widge...
lua
chosen
[ { "from": "system", "value": "Set as cut with a scaling factor of 1/4.\n" }, { "from": "human", "value": "dofile 'lampshade.lua'\n\nlocal config = {\n tolerance = 1,\n thickness = 3,\n profile_number = 4, -- shall be 20 to be nicer\n angle = 30, -- default is zero\n bottom = {\n e...
lua
chosen
[ { "from": "human", "value": "[Test] Add smtp addr unit test\n" }, { "from": "gpt", "value": "-- SMTP address parser tests\n\ncontext(\"SMTP address check functions\", function()\n local logger = require(\"rspamd_logger\")\n local ffi = require(\"ffi\")\n require \"fun\" ()\n ffi.cdef[[\n st...
lua
chosen
[ { "from": "system", "value": "Add play unicode symbol to Media Player menubar item\n" }, { "from": "human", "value": "hook.Add( \"PopulateMenuBar\", \"MediaPlayerOptions_MenuBar\", function( menubar )\n\n\tlocal m = menubar:AddOrGetMenu( \"Media Player\" )\n\n\tm:AddCVar( \"Fullscreen\", \"media...
lua
chosen
[ { "from": "system", "value": "Change of location of connect function and\n\nAlso some extra tracing through the json.serialize command.\n" }, { "from": "human", "value": "\nfunction bm.app.listBeds(Request)\n local DB = connect()\n local Data = DB:query{sql=\"SELECT * FROM bed\"}\n\n local...
lua
chosen
[ { "from": "system", "value": "Implement workaround for pressing buttons on multiple frames\n" }, { "from": "human", "value": "function read_file(filename)\n local input = io.open(filename, 'r')\n if input ~= nil then\n io.input(input)\n input_content = io.read()\n io.c...
lua
chosen
[ { "from": "system", "value": "Remove logging from unit test where there is no valid context to log with.\n" }, { "from": "human", "value": "\nt=...\n\nlocal log = function(...)\n io.stderr:write(\" -- \")\n io.stderr:write(...)\n io.stderr:write(\"\\n\")\nend\n \n\nif t == nil then\n log(\"...
lua
chosen
[ { "from": "human", "value": "Implement little game in Lua\n" }, { "from": "gpt", "value": "Villain = {\n health = 100,\n new = function(self, name)\n local obj = {\n name = name,\n health = self.health\n }\n -- using metatables to let obj lookup m...
lua
chosen
[ { "from": "system", "value": "Use new format for argument test.\n" }, { "from": "human", "value": "-- Test arguments\nassert(select(1, ...) == true, \"arg 1 must be true\")\nassert(select(2, ...) == false, \"arg 2 must be false\")\nassert(select(3, ...) == nil, \"arg 3 must be nil\")\nassert(sel...
lua
chosen
[ { "from": "system", "value": "Allow running other tools than pkg-config.\n\nUseful for e.g. wx-config.\nClean up option handling to ignore newlines and other junk\n" }, { "from": "human", "value": "module(..., package.seeall)\n\nfunction Configure(name, constructor)\n local fh = assert(io.popen...
lua
chosen
[ { "from": "system", "value": "Build/UnitTest: Fix linking against Network module\n\n\nFormer-commit-id: 01a994a6bf23fa8296ef087157d3d88598c1bb31 [formerly 929a9a29884daa2676c9e54f55361ecbd742fe37]\nFormer-commit-id: d5437f0a27908e9e8a87e04aff14ddbb3c849b07" }, { "from": "human", "value": "TOOL.N...
lua
chosen
[ { "from": "human", "value": "Add config file to accelerometer\n" }, { "from": "gpt", "value": "local function station(tmr)\n print(wifi.sta.getip())\n if wifi.sta.getip() then\n tmr:stop()\n hasip = true\n end\nend\n\nlocal function conmqtt(tmr)\n if not hasconnected then\n ...
lua
chosen
[ { "from": "system", "value": "Remove the 'destroy' call, because the error won't be propagated.\n" }, { "from": "human", "value": "require \"lunit\"\r\n\r\nmodule(..., lunit.testcase, package.seeall)\r\n\r\nfunction test()\r\n\r\nlocal catched = false\r\n\r\nlocal net = require \"luanode.net\"\r...
lua
chosen
[ { "from": "system", "value": "Update weblit again to close security hole\n" }, { "from": "human", "value": "return {\n name = \"luvit/blog.luvit.io\",\n version = \"0.0.3\",\n private = true,\n dependencies = {\n -- hoedown ffi bindings for fast markdown compiling\n \"creationix/hoedow...
lua
chosen
[ { "from": "human", "value": "Add 32F746GDISCOVERY board to tup build" }, { "from": "gpt", "value": "--\n-- file: Tupfile.lua\n--\n-- author: Copyright (C) 2014-2017 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info\n--\n-- This Source Code Form is subject to the terms of the...
lua
chosen
[ { "from": "system", "value": "Rename option* -> fn* to reflect key name\n\nI saw that the contents of the optionHandler function were updated to\nwatch for presses of the \"fn\" key instead of the \"alt\" key. At that time\nthe function (and its corresponding functions) were not renamed. This\ncommit aims t...
lua
chosen
[ { "from": "system", "value": "Remove unnecessary leftover stuff from HedgeLib premake\n" }, { "from": "human", "value": "project(\"HedgeLib\")\n language(\"C\")\n\n targetdir(\"bin/%{cfg.platform}/%{cfg.buildcfg}\")\n runpathdirs(\"bin/%{cfg.platform}/%{cfg.buildcfg}\")\n \n inclu...
lua
chosen
[ { "from": "system", "value": "Add indent-blankline setting for blank lines\n" }, { "from": "human", "value": "vim.g.indent_blankline_space_char = \" \"\nvim.g.indent_blankline_char = \"│\"\nvim.g.indent_blankline_show_current_context = true\nvim.g.indent_blankline_space_char_blankline = \" \"\n\...
lua
chosen
[ { "from": "system", "value": "Define _DEFAULT_SOURCE, fixing compilation on glibc >= 2.19" }, { "from": "human", "value": "-- bcc compiler.\n\nsolution 'bcc'\n configurations 'release'\n language 'C'\n buildoptions {\n '-Wall',\n '-Werror',\n '-Wno-error=switch',\n '-Wn...
lua
chosen
[ { "from": "system", "value": "Use %p format for FFI code.\n" }, { "from": "human", "value": "object \"method_call\" {\n\tc_source[[\ntypedef struct method_call method_call;\n\n#define DEFAULT_PTR ((method_call *)0xDEADBEEF)\n\nmethod_call *method_call_create() {\n\treturn DEFAULT_PTR;\n}\n\nvoid...
lua
chosen
[ { "from": "human", "value": "chore(utilities): Add module to smooth over various Lua bit libraries\n" }, { "from": "gpt", "value": "--[[ This module smooths over all the various Lua bit libraries\n\nSourced from:\nhttps://github.com/daurnimator/lua-http/blob/v0.3/http/bit.lua\n\nNote using these...
lua
chosen
[ { "from": "human", "value": "Implement basic emulator listening interface\n" }, { "from": "gpt", "value": "prev = \"\";\nmsg = \"\";\n\nfunction write_file (filename, text)\n output = io.open(filename, \"w\");\n io.output(output);\n io.write(text);\n io.close(output);\nend;\n\nfuncti...
lua
chosen
[ { "from": "human", "value": "Add test of 'c' with linewise movement (fails).\n" }, { "from": "gpt", "value": "test.open('words.txt')\nlocal lineno = test.lineno\nlocal colno = test.colno\nlocal assertEq = test.assertEq\n\ntest.key('c', 'j', 'x', 'y', 'z', 'escape')\nassertEq(lineno(), 0)\nassert...
lua
chosen
[ { "from": "system", "value": "Patch assert(). Allow multiple parameters.\n" }, { "from": "human", "value": "require('core.env.strict')\nrequire('core.env.fenv')\nrequire('core.env.table')\n\n" }, { "from": "gpt", "value": "require('core.env.strict')\nrequire('core.env.fenv')\nrequire...
lua
chosen
[ { "from": "system", "value": "Prepare non-beta release of 2.6.22\n" }, { "from": "human", "value": "return {\n name = \"rackspace-monitoring-agent\",\n version = \"2.6.22-beta1\",\n luvi = {\n version = \"2.9.3-1-sigar\",\n flavor = \"sigar\",\n url = \"https://github.com/virgo-agent...
lua
chosen
[ { "from": "system", "value": "Add support for mapping a Hyper binding to a custom function\n" }, { "from": "human", "value": "local status, hyperModeAppMappings = pcall(require, 'keyboard.hyper-apps')\n\nif not status then\n hyperModeAppMappings = require('keyboard.hyper-apps-defaults')\nend\n\...
lua
chosen
[ { "from": "system", "value": "Remove extra MSVC warning C4141 from Clang build.\n" }, { "from": "human", "value": "clang_msvc_flags =\n{\n \"/wd4146\", \"/wd4244\", \"/wd4800\", \"/wd4345\",\n \"/wd4355\", \"/wd4996\", \"/wd4624\", \"/wd4291\",\n \"/wd4251\"\n}\n\nif not (string.starts(action...
lua
chosen
[ { "from": "system", "value": "Fix name of unused but commonly referenced frame in pocket layout\n" }, { "from": "human", "value": "local book = SILE.require(\"classes/book\");\nbook:defineMaster({ id = \"right\", firstContentFrame = \"content\", frames = {\n content = {left = \"20mm\", right = ...
lua
chosen
[ { "from": "system", "value": "Fix typo: erorr -> error." }, { "from": "human", "value": "local PlinesAPI = {}\n\nfunction PlinesAPI.expire_job_batch(\n pipeline_name, id, data_ttl_in_milliseconds\n)\n return Plines.job_batch(pipeline_name, id):expire(data_ttl_in_milliseconds)\nend\n\nfunction ...
lua
chosen
[ { "from": "system", "value": "Add error message to output of function db_query().\n" }, { "from": "human", "value": "local DBI, dbh = require 'DBI'\n\nfunction db_connect(db_id)\n if db_id == nil then db_id = 'default' end\n\n local connection = settings.db[db_id]\n\n if connection == nil the...
lua
chosen
[ { "from": "system", "value": "Use lua only to track irc users\n" }, { "from": "human", "value": "--\n-- Copyright 2015 Ilkka Oksanen <iao@iki.fi>\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- you may not use this file except in compliance with the License.\n...
lua
chosen
[ { "from": "system", "value": "Add setting of seed for random number generator\n" }, { "from": "human", "value": "#!/usr/bin/lua\n\nfunction getRandomValue(lower, upper)\n return math.random(lower,upper*100)/100\nend\n\nfunction Main()\n\nprint(\"LOAD_1_MINUTE\",getRandomValue(0,20))\nprint(\"L...
lua
chosen
[ { "from": "system", "value": "Write CC to file before replacing it with RR\n" }, { "from": "human", "value": "--\n-- SmartMet NWC parameters\n--\n-- Check consistency between total cloudiness and precipitation; first one\n-- is modified accordingly.\n--\n-- Also remove light precipitation during...
lua
chosen
[ { "from": "system", "value": "Update support for latest telescope.\n" }, { "from": "human", "value": "-- sudo luarocks install lpeg\n-- sudo luarocks install struct\n\ninspect = require 'spec.inspect'\n\nlocal function compare_tables(t1, t2)\n local ty1 = type(t1)\n local ty2 = type(t2)\n if ...
lua
chosen
[ { "from": "system", "value": "Update config reloader path watch\n" }, { "from": "human", "value": "local module = {}\n\nmodule.init = function()\n\tfunction reloadConfig(files)\n\t\tdoReload = false\n\t\tfor _,file in pairs(files) do\n\t\t\tif file:sub(-4) == \".lua\" then\n\t\t\t\tdoReload = tr...
lua
chosen
[ { "from": "human", "value": "Work on pure Lua IF: t--\n" }, { "from": "gpt", "value": "--[[\nCopyright 2015 Jeffrey Kegler\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the \"Software\"),\nto deal in the Softwa...
lua
chosen
[ { "from": "system", "value": "Use utf-8, not entities, for smart punctuation.\n" }, { "from": "human", "value": "-- (c) 2009-2011 John MacFarlane. Released under MIT license.\n-- See the file LICENSE in the source for details.\n\nmodule(\"lunamark.writer.xml\", package.seeall)\n\nlocal gsub = st...
lua
chosen
[ { "from": "system", "value": "Enable storing creds via env vars\n" }, { "from": "human", "value": "-------------------------------------------------\n-- Allows to store client specific settings in one place\n--\n-- @author Pavel Makhov\n-- @copyright 2019 Pavel Makhov\n--------------------------...
lua
chosen
[ { "from": "system", "value": "Allow initialization of data when creating states\n" }, { "from": "human", "value": "local State = {}\n\nsetmetatable(State, {\n __call = function(_, name, transitions)\n local state = {}\n state.name = name\n state.transitions = transitions\n state.cor...
lua
chosen
[ { "from": "system", "value": "Test multiple statements in one execution.\n" }, { "from": "human", "value": "python = require 'python'\n\nassert(nil == python.eval \"None\")\nassert(true == python.eval \"True\")\nassert(false == python.eval \"False\")\n\nassert(1 == python.eval \"1\")\nas...
lua
chosen
[ { "from": "system", "value": "Print message for the deaf\n" }, { "from": "human", "value": "responses = {}\n\nresponses['dotabuff.com/matches/'] = function(message, commands)\n local username = message.user.name\n local url = message.text:match('dotabuff.com/matches/(%d+)')\n local user...
lua
chosen
[ { "from": "system", "value": "Set the refresh of the player positions to 60sec" }, { "from": "human", "value": "local time_interval = 1.0\nlocal fifo_path = \"/home/quentinbd/minetest/worlds/minetestforfun/mt_players_fifo\"\n\nfunction players_data()\n local ps = {}\n for _, player in ipai...
lua
chosen
[ { "from": "system", "value": "Disable LSP for gitcommit file type\n" }, { "from": "human", "value": "local cmp = require(\"cmp\")\n\ncmp.setup({\n\tformatting = {\n\t\tformat = function(entry, item)\n\t\t\titem.menu = entry.source.name\n\t\t\treturn item\n\t\tend,\n\t},\n\tmapping = {\n\t\t[\"<T...
lua
chosen
[ { "from": "system", "value": "Clean up cpu config script\n" }, { "from": "human", "value": "debug = false\n\nfunction Initialize()\n\n\tdofile(SKIN:GetVariable('scriptPath') .. 'Utilities.lua')\n\tcpuCores = SKIN:GetVariable('cpuCores')\n\tthreadsPerCore = SKIN:GetVariable('threadsPerCore')\n\n\...
lua
chosen
[ { "from": "system", "value": "Use an indentation of 2. Let's be gentlemen, here.\n" }, { "from": "human", "value": "function love.load()\n love.window.setTitle(\"Tacktx\")\n\n -- Load our hex images.\n local tileset = \"tilesets/flat_left_right/\"\n sheep_hex = love.graphics.newImage...
lua
chosen
[ { "from": "human", "value": "feat(Hammerspoon): Add a modal keyboard hotkey file to pair with my Sweet16 macropad\n" }, { "from": "gpt", "value": "local f20modal = hs.hotkey.modal.new('cmd', 'f20')\n\nfunction f20modal:entered()\n hs.timer.doAfter(1, function() f20modal:exit() end)\n-- hs.ale...
lua
chosen
[ { "from": "system", "value": "Add Hammerspoon config for window management\n" }, { "from": "human", "value": "hs.logger.defaultLogLevel=\"info\"\n\nhyper = {\"ctrl\", \"alt\", \"cmd\"}\nhypershift = {\"ctrl\", \"alt\", \"cmd\", \"shift\"}\n\nhs.loadSpoon(\"SpoonInstall\")\n\nspoon.SpoonInstall.u...
lua
chosen
[ { "from": "system", "value": "PDTK-74: Remove light precipitation during summer months\n" }, { "from": "human", "value": "--\n-- SmartMet NWC parameters\n--\n-- Check consistency between total cloudiness and precipitation; first one\n-- is modified accordingly\n-- \n\nlocal CC = luatool:FetchWit...
lua
chosen
[ { "from": "system", "value": "Change mapgen of uranium ore between levels -80 and -28000\n" }, { "from": "human", "value": "-- make silver, tin, mithril to be grinded\n--[[local recipes = {\n\t-- Dusts\n\t{\"default:tin_lump\", \"technic:tin_dust 2\"},\n\t{\"moreores:silver_lump\", \"technic:sil...
lua
chosen
[ { "from": "system", "value": "Fix errors in setup and report for composite feedback\n" }, { "from": "human", "value": "------------------------------------------------------------------------\n--[[ CompositeFeedback ]]--\n-- Feedback\n-- Composite of many Feedback components\n-------------------...
lua
chosen
[ { "from": "human", "value": "Include 0% coverage files in the luacov report\n" }, { "from": "gpt", "value": "-- Dummy test file for including files with 0% coverage in the luacov report\n\nlocal test_env = require(\"spec.util.test_env\")\nlocal testing_paths = test_env.testing_paths\n\ntest_env....
lua
chosen
[ { "from": "system", "value": "Use link titles not text for full reference\n" }, { "from": "human", "value": "local yaml = require(\"yaml\")\n\nPandoc = function (document)\n local versedata = yaml.loadpath(document.meta.versedatafile)\n\n document.blocks = pandoc.walk_block(pandoc.Div(document...
lua
chosen