nut.db.delete - brianhang/nutscript2 GitHub Wiki

Description

nut.db.delete(tableName, condition, callback, limit)

This server function removes rows within tableName that fit the given condition. The number of rows is limited by limit, which can either be a number for limiting a certain amount, a string for more complex limits, or nil for no limit.

Parameters

Name Description
tableName The string name for the table to delete rows from.
condition A string for under which condition a row should be deleted.
callback An optional function that is called after the delete query is finished. The only parameter is result which is the result of the deletion. If result is nil, then an error occurred.
limit An optional number that is the limit for the number of rows that can be deleted. By default there is no limit.

Side Effects

  • Rows are deleted from the database.

Errors

  • tableName is not a string

Example

-- Delete the first character found named "Delete Me"
nut.db.delete("character", "name = 'Delete Me'", nil, 1)